例如,如果我在R中创建函数,则:
f<-function(x){
x
.....
}
执行函数R使用按值传递或按引用传递时
答案 0 :(得分:-1)
In R it is call by value. To prove this i tried with a small function as below;
f1 <- function(a,b){
print(a)
#print b value before call
print(b)
fi(b)
#print b value after call
print(b)
}
fi <- function(i){
i = i + 20
}
f1(10,20)
output :
----------
[1] 10
[1] 20
[1] 20