[英]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.