l******9 发帖数: 579 | 1 【 以下文字转载自 Statistics 讨论区 】
发信人: light009 (light009), 信区: Statistics
标 题: pass arguments by reference in R
发信站: BBS 未名空间站 (Fri Apr 11 14:19:03 2014, 美东)
I need to do pass by reference in R by R studio on win 7.
My code:
myfunc<-function(myhash.arg, b)
{
myhash <- myhash.arg
if (!has.key("first", myhash))
myhash["first"] <- list()
alist <- myhash["first"]
alist <- append(alist, i)
eval.parent(substitute(myhash.arg<-myhash))
return(0)
}
ahash<-hash()
for(i in 1:5)
{
myfunc(myhash... 阅读全帖 |
|
l******9 发帖数: 579 | 2 【 以下文字转载自 Statistics 讨论区 】
发信人: light009 (light009), 信区: Statistics
标 题: pass arguments by reference in R
发信站: BBS 未名空间站 (Fri Apr 11 14:19:03 2014, 美东)
I need to do pass by reference in R by R studio on win 7.
My code:
myfunc<-function(myhash.arg, b)
{
myhash <- myhash.arg
if (!has.key("first", myhash))
myhash["first"] <- list()
alist <- myhash["first"]
alist <- append(alist, i)
eval.parent(substitute(myhash.arg<-myhash))
return(0)
}
ahash<-hash()
for(i in 1:5)
{
myfunc(myhash... 阅读全帖 |
|
l******9 发帖数: 579 | 3 【 以下文字转载自 Statistics 讨论区 】
发信人: light009 (light009), 信区: Statistics
标 题: pass arguments by reference in R
发信站: BBS 未名空间站 (Fri Apr 11 14:19:03 2014, 美东)
I need to do pass by reference in R by R studio on win 7.
My code:
myfunc<-function(myhash.arg, b)
{
myhash <- myhash.arg
if (!has.key("first", myhash))
myhash["first"] <- list()
alist <- myhash["first"]
alist <- append(alist, i)
eval.parent(substitute(myhash.arg<-myhash))
return(0)
}
ahash<-hash()
for(i in 1:5)
{
myfunc(myhash... 阅读全帖 |
|
l******9 发帖数: 579 | 4 I need to do pass by reference in R by R studio on win 7.
My code:
myfunc<-function(myhash.arg, b)
{
myhash <- myhash.arg
if (!has.key("first", myhash))
myhash["first"] <- list()
alist <- myhash["first"]
alist <- append(alist, i)
eval.parent(substitute(myhash.arg<-myhash))
return(0)
}
ahash<-hash()
for(i in 1:5)
{
myfunc(myhash.arg = ahash, b = i)
print(c("length of ahash is ", length(ahash)))
print(c("length of ahash list is ", length(ahash["first"])))
}
but, the list size... 阅读全帖 |
|