read.table bug
Li Dongfeng <mavip5 at inet.polyu.edu.hk> writes:
Suppose we have a data file containing:
"Smith, John", 120, 90
"Thomson, Peter", 110, 85
there are 3 variables in it. If we use
x <- read.table("tmp.txt", sep=",")
to read the data to a data.frame,
the result will be 4 columns.
Splus 4.0 have no problem with this kind
of data.
Splus 3.4 has:
read.table("data", sep=",")
V2 V3 V4 "Smith John\" 120 90 "Thomson Peter\" 110 85 i.e. 3 variables but with row.names '"Smith' and '"Thomson' Or, closer to what R does:
read.table("data", sep=",",row.names=NULL)
V1 V2 V3 V4 1 \"Smith John\" 120 90 2 \"Thomson Peter\" 110 85 By its definition, this is what sep=',' must do, but it obviously will not handle all CSV files properly. Anyone want to write a read.csv() function or something of the sorts? It would be very useful.
O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._