[R] generating factors from the edit function
Dieter Menne
dieter.menne at menne-biomed.de
Sat Mar 5 10:56:44 CET 2011
Erin Hodgess-2 wrote:
>
> Here is a little function that I put together:
>
>> fact1
> function(x) {
> n <- ncol(x)
> for(i in 1:n) {
> if(mode(x[,i])=="character")x[,i] <- factor(x[,i])
> }
> return(x)
> }
>>
>
>
See
http://www.mail-archive.com/r-help@stat.math.ethz.ch/msg22459.html
for a more R-ish approach. I find the d[] <- an FFQ (frequently forgotten
solution)
Dieter
--
View this message in context: http://r.789695.n4.nabble.com/generating-factors-from-the-edit-function-tp3336273p3336455.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list