The file, daily_records.dat, contains these data: "station","date","amount" "0.3E",2014-01-01, "0.3E",2014-01-02, "0.3E",2014-01-03,0.01 "0.3E",2014-01-04,0.00 "0.3E",2014-01-05,0.00 "0.3E",2014-01-06,0.00 "0.3E",2014-01-07,0.10 "0.3E",2014-01-08,0.22 "0.3E",2014-01-09,0.49
Using read.table("daily_records.dat", header = TRUE, sep = ",", quote = "\"\"") the data are assigned to a data.frame named 'rain.' I expect the structure to show station and date as factors with amount as numeric, but they're all factors: str(rain) 'data.frame': 341 obs. of 3 variables: $ station: Factor w/ 6 levels "0.3E","0.6W",..: 1 1 ... $ date : Factor w/ 62 levels "2013-12-01","2013-12-02",..: 32 33 34 ... $ amount : Factor w/ 48 levels "","0.00","0.01",..: 1 1 3 2 ... Why is amount taken as a factor rather than numeric? I do not recall having numbers read as factors before this. I expect to need to convert dates using as.Date() but not to convert numbers. TIA, Rich ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.