[R] Read.table mucks up headers

Uwe Ligges ligges at statistik.tu-dortmund.de
Sat Apr 19 15:12:47 CEST 2014



On 19.04.2014 14:30, starter wrote:
> 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")


Which R version?
Are you sure this is UTF-8-BOM and not "UCS-2LE" or "UTF-16LE"?

Best,
Uwe Ligges


>> 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.
>
> ______________________________________________
> R-help at 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.
>




More information about the R-help mailing list