Skip to content
Prev 303278 / 398506 Next

pass by reference

You have to return the value of 'data' from the function.  Functions
do not have "side effects".
+     data$col2[data$col1<=2]="L"
+     data  # return value
+ }
col1 col2
1    1    L
2    2    L
3    3 <NA>
4    4 <NA>
5    5 <NA>
On Mon, Aug 13, 2012 at 9:08 PM, Sachinthaka Abeywardana
<sachin.abeywardana at gmail.com> wrote: