Displaying 1 result from an estimated 1 matches for "getcol2".
Did you mean:
getcol
2012 Aug 14
4
pass by reference
Hi all,
I want to do the following:
data<-data.frame(col1=c(1,2,3,4,5))
getcol2<-function(data){
data$col2[data$col1<=2]="L"
}
getcol2(data)
Unfortunately in the above col2 does not appear in the final data. So how
would you pass this by reference such that you would get it back?
Thanks,
Sachin
[[alternative HTML version deleted]]