>From ?data.frame: Character variables passed to 'data.frame' are converted to factor columns unless protected by 'I'. If a list or data frame or matrix is passed to 'data.frame' it is as if each column had been passed as a separate argument.
See the Examples section for an example. On Tuesday 02 September 2003 17:30, Dutky, Steve wrote: > I have a function that manipulates a list of numeric and character > components of equal length and wants to return a data.frame. > > EG, > > f<-function() { > a<-list(Int1=1:5,Char1=letters[1:5],Char2=letters[6:10]) > b<-data.frame(a) > } > > How can I get the columns Char1, Char2, (...CharN) returned coerced to > character and not factor? > > It appears that I could coerce individual columns by > b$CharI<-as.character(b$CharI). Is there a less ugly way of doing this? ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help