Re: [R] HELP - as.numeric changing column data

2016-01-06 Thread William Dunlap via R-help
By the way, here is an example where the advice in FAQ 7.10 (change the factor columns to numeric) would give incorrect results. The incorrect header setting in the call to read.table causes an extra row of non-numeric data to appear at the start of the imported data. > txt <- "ColA ColB\n101 1

Re: [R] HELP - as.numeric changing column data

2016-01-06 Thread William Dunlap via R-help
You may have read in your data incorrectly - a column you expected to be numeric was not recognized as such so it was read in a character and then converted to a 'factor'. FAQ 7.10 tells how to work around the problem https://cran.r-project.org/doc/FAQ/R-FAQ.html#How-do-I-convert-factors-to-numer