[R] Read.table mucks up headers

starter pavneet.arora at uk.rsagroup.com
Sat Apr 19 14:30:54 CEST 2014


Hello Milan

It had worked perfectly before, but now I am trying on a different text file
but using the trick you showed I just get the headers in the output and that
too as "row.names" and "X".

*code:*
corr <- read.table("E:/temp/corrosion
data.txt",header=T,fileEncoding="UTF-8-BOM")

> dput(corr)
structure(list(ï...Weight. = c(13.74, 12.97, 10.78, 10.53, 10.16, 
9.38, 9.23, 9.2, 17.24, 18, 15.12, 16.08, 13.71, 13.81, 12.61, 
14.03), Piece = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L), Time = c(96L, 84L, 72L, 60L, 48L, 36L, 24L, 
12L, 96L, 96L, 72L, 60L, 48L, 36L, 24L, 12L)), .Names = c("ï...Weight.", 
"Piece", "Time"), class = "data.frame", row.names = c(NA, -16L
))

> str(corr)
'data.frame':	16 obs. of  3 variables:
 $ ï...Weight.: num  13.7 13 10.8 10.5 10.2 ...
 $ Piece      : int  1 1 1 1 1 1 1 1 2 2 ...
 $ Time       : int  96 84 72 60 48 36 24 12 96 96 ...

Please tell me what I am doing wrong.



--
View this message in context: http://r.789695.n4.nabble.com/Read-table-mucks-up-headers-tp4688742p4689099.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list