简体   繁体   English

如何不使用第一次观察作为 R 中的列名?

[英]How to not use first observation as column names in R?

I have some data files without column headings and every time I import them into the workspace R will read the first observation as variable names.我有一些没有列标题的数据文件,每次将它们导入工作区时,R 都会将第一个观察结果读取为变量名称。 Is there any way to prevent R from doing this?有什么办法可以阻止 R 这样做吗?

In read.table the option header=FALSE will not read the first observation as variable name.read.table ,选项header=FALSE不会将第一个观察结果读取为变量名。

Example:例子:

write.csv(iris, "temp.csv")
read.table("temp.csv", sep=",", header=FALSE)

Works for read.csv(..., header=FALSE) too.也适用于read.csv(..., header=FALSE)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM