I have yet another novice 'converting factors to numeric problem'. The problem is as described by others: read data (using read.csv) in from excel.csv file and it turns out to be a factor in R. The data in execl only has 4 rows:
treat absorb 0 1.8052 0.5 2.07075 1.0 2.2345 I read the object in as s1 and generated the following r-code and output trying a couple of things: as.numeric(as.character(s1)) [1] NA Warning: > sapply(s1, class) treat.absorb "factor" > as.numeric(as.character(s1)) [1] NA Warining: NAs produced by conversion > as.numeric(as.character(s1$absorb)) numeric(0) > s1$absorb <- as.numeric(as.character(s1$absorb)) Error in `$<-.data.frame`(`*tmp*`, "absorb", value = numeric(0)) : replacement has 0 rows, data has 3 thanks for your consideration Andreas -- View this message in context: http://r.789695.n4.nabble.com/convert-factor-data-to-numeric-tp1012855p2996406.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.