Re: [R] Factor Madness

2007-12-20 Thread John Kane
You may be haning Ion coerced into a factor. Have a look at http://finzi.psych.upenn.edu/R/Rhelp02a/archive/98260.html for some discussion of this. I find that I usually set options(stringsAsFactors = FALSE) just because of this but as Gabor points out it may have its own disadvantages in shar

Re: [R] Factor Madness

2007-12-19 Thread Johannes Graumann
As Tony assumed: a data frame. Joh John Kane wrote: > What was spectrum orginally? > > > --- Johannes Graumann <[EMAIL PROTECTED]> > wrote: > >> Why is class(spectrum[["Ion"]]) after this "factor"? >> >> spectrum <- cbind(spectrum,Ion=rep("", >> nrow(spectrum)),Deviation.AMU=rep(0.0, >> nrow

Re: [R] Factor Madness

2007-12-19 Thread John Kane
What was spectrum orginally? --- Johannes Graumann <[EMAIL PROTECTED]> wrote: > Why is class(spectrum[["Ion"]]) after this "factor"? > > spectrum <- cbind(spectrum,Ion=rep("", > nrow(spectrum)),Deviation.AMU=rep(0.0, > nrow(spectrum))) > > slowly going crazy ... > > Joh > > _

Re: [R] Factor Madness

2007-12-19 Thread Johannes Graumann
Yep, but I figured that out quite fast ;0) Thanks for giving me a hand ... you want believe a many times I skimmed the cbind help without actually seeing this ... well, it was 0:30 ... Thanks again, Joh Tony Plate wrote: > Whoops, it looks like there's a typo in ?cbind (R version 2.6.0 Patched >

Re: [R] Factor Madness

2007-12-18 Thread Tony Plate
Whoops, it looks like there's a typo in ?cbind (R version 2.6.0 Patched (2007-10-11 r43143)), and I blindly copied it into my message. That should read (emphasis added): "and convert character columns to factors unless stringsAsFactors = ***FALSE***" Here's an example: > x <- data.frame(X=1:

Re: [R] Factor Madness

2007-12-18 Thread Tony Plate
From ?cbind: Data frame methods The cbind data frame method is just a wrapper for data.frame(..., check.names = FALSE). This means that it will split matrix columns in data frame arguments, and convert character columns to factors unless stringsAsFactors = TRUE is passed. (I'm guessing 'spect

[R] Factor Madness

2007-12-18 Thread Johannes Graumann
Why is class(spectrum[["Ion"]]) after this "factor"? spectrum <- cbind(spectrum,Ion=rep("", nrow(spectrum)),Deviation.AMU=rep(0.0, nrow(spectrum))) slowly going crazy ... Joh __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r