search for: chr2factors

Displaying 1 result from an estimated 1 matches for "chr2factors".

2005 Jun 01
1
many chr2factors ?
Hi, i would like transfrom characters from a data.frame to factors automatic. > tofac <- function(df){ + i=0 + repeat{ + i <- i+1 + if(!is.character(df[,i])) + next + df[,i] <- as.factor(df[,i]) + print(i) + if(i == length(df)) + break } + } > > tofac(abrdat) [1] 7 [1] 8 [1] 9 [1] 11 [1] 13 [1] 15 Error in "[.data.frame"(df, , i) : undefined columns selected This