Re: [R] as.numeric() generates NAs inside an apply call, but fine outside of it

2012-01-09 Thread Petr PIKAL
Hi > Hello- > > I have rather a messy SPSS file which I have imported to R, I've dput'd > some of the columns at the end of this message. I wish to get rid of all > the labels and have numeric values using as.numeric. The funny thing is > it works like this: > > as.numeric(mydata[,2]) # gene

Re: [R] as.numeric() generates NAs inside an apply call, but fine outside of it

2012-01-09 Thread Chris Beeley
Perfect, many thanks for explanation and correct line of code. On 09/01/2012 14:29, peter dalgaard wrote: as.data.frame(lapply(mydata, as.numeric)) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the p

Re: [R] as.numeric() generates NAs inside an apply call, but fine outside of it

2012-01-09 Thread peter dalgaard
On Jan 9, 2012, at 15:11 , Chris Beeley wrote: > Hello- > > I have rather a messy SPSS file which I have imported to R, I've dput'd some > of the columns at the end of this message. I wish to get rid of all the > labels and have numeric values using as.numeric. The funny thing is it works > l

[R] as.numeric() generates NAs inside an apply call, but fine outside of it

2012-01-09 Thread Chris Beeley
Hello- I have rather a messy SPSS file which I have imported to R, I've dput'd some of the columns at the end of this message. I wish to get rid of all the labels and have numeric values using as.numeric. The funny thing is it works like this: as.numeric(mydata[,2]) # generates correct numbe