【问题标题】:Exclude columns in read.table() in R [duplicate]排除 R 中 read.table() 中的列 [重复]
【发布时间】:2011-08-21 15:02:47
【问题描述】:

可能重复:
Only read limited number of columns in R

我有一个数据文本文件,其中包含一百万个观测值和 150 个变量(v1 到 v150),以分号分隔。我只需要选定的少数变量。有没有办法只读取我需要的变量?我正在使用read.table("filepath/filename.txt", sep=";", header=T)。除了read.table(),还有其他方法可以做到吗?

【问题讨论】:

    标签: r


    【解决方案1】:

    参见help(read.table),尤其是colClasses 参数。只需将要忽略的列设置为NULL,它们就会被跳过。

    【讨论】:

      猜你喜欢
      • 2012-10-26
      • 2014-04-30
      • 1970-01-01
      • 2016-03-29
      • 2020-10-29
      • 2010-11-18
      • 2020-12-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多