Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可能重复: 仅读取 R 中有限数量的列
我有一个由三列组成的 ascii 数据集,但只有最后两列是实际数据。现在我想使用read.csv(file = "result1", sep= " "). R 读取所有三列。我该如何避免这种情况?
read.csv(file = "result1", sep= " ")
您可以使用colClasses参数跳过列:
colClasses
mydata <- read.csv('mydata.csv', colClasses=c('NULL',NA,NA))
或者
mydata <- read.csv('mydata.csv', colClasses=c('NULL', 'numeric', 'numeric'))