This question already has an answer here:
这个问题在这里已有答案:
- R: loading a table with number as the column heading all were wrongly added a X, how to solve it? 1 answer
- R:加载一个带有数字的表作为列标题都被错误地添加了一个X,如何解决? 1个答案
I want to read in a normal .txt file with a header that contains some numbers like this:
我想读一个普通的.txt文件,其中包含一些包含这样的数字的标题:
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:
生成的myf标题变为:
Samples X1e.2 X1e.3 X1e.4
So my question is how do I read the header the way I wanted?
所以我的问题是如何按照我想要的方式阅读标题?
Thanks!
谢谢!
1 个解决方案
#1
1
Use check.names
= FALSE
使用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
#1
1
Use check.names
= FALSE
使用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