Displaying 1 result from an estimated 1 matches for "var_name_to_split".
2010 Dec 06
3
[plyr] Question regarding ddply: use of .(as.name(varname)) and varname in ddply function
Dear R-Helpers:
I am using trying to use *ddply* to extract min and max of a particular
column in a data.frame. I am using two different forms of the function:
## var_name_to_split is a string -- something like "var1" which is the name
of a column in data.frame
ddply( df, .(as.name(var_name_to_split)), function(x) c(min(x[ , 3] , max(x[
, 3]))) ## fails with an error - case 1
ddply( df, var_name_to_split , function(x) c(min(x[ , 3] , max(x[ , 3])))
#...