I want to read in a normal .txt file with a header that contains some numbers like this:

Samples 1e-2 1e-3 1e-4
Apple   200   150  100

After using:

myf<-read.table("file.txt",header=T)

the resulting myf header becomes:

Samples X1e.2 X1e.3 X1e.4

So my question is how do I read the header the way I wanted?

Thanks!

有帮助吗?

解决方案

Use check.names = FALSE

> read.table(header = TRUE, text = "1e-2 1e-3 1e-4
+ 200   150  100", check.names = FALSE)
  1e-2 1e-3 1e-4
1  200  150  100
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top