Returning the changed value as in Erik's answer is probably the
most common and R-like solution but here are two others. The
assign/get approach is perhaps the closest to what you are asking
for.
# replacement function approach
# replacement function - rhs is formula whose response is assigned t
g [mailto:r-help-boun...@r-project.org] On
Behalf Of Alexander Shenkin
Sent: Wednesday, August 12, 2009 9:27 AM
To: r-help@r-project.org
Subject: [R] Symbolic references - passing variable names into functions
Hello All,
I am trying to write a function which would operate on columns of a
dataframe specifi
Hello All,
I am trying to write a function which would operate on columns of a
dataframe specified in parameters passed to that function.
f = function(dataf, col1 = "column1", col2 = "column2") {
dataf$col1 = dataf$col2 # just as an example
}
The above, of course, does not work a
3 matches
Mail list logo