Displaying 1 result from an estimated 1 matches for "defactorise".
2009 Apr 03
1
"factorise" variables in a data.frame
...str(d)
str(d2)
I'd like to write a function factorise() which takes a data.frame and
a vector of variable names, and returns the original data.frame with
the desired variables converted to factor,
factorise <- function(d, f)
***ply(d, f, factor) # some apply function
also, perhaps a defactorise() function doing the reverse operation
with as.numeric.
I played with the plyr package and the base apply family for a while
but can't find any concise construct.
Best regards,
baptiste
_____________________________
Baptiste Augui?
School of Physics
University of Exeter
Stocker Road...