search for: abrdat

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

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 are the correct columns and i get the idea put into the loop a empty matrix with dimension like df and return it!? Another check? abrdat2 <- apply(abrdat,2,function(x) ifelse(i...