[R] is there a way to read a specific column from a txt file

Paul Smith phhs80 at gmail.com
Sun May 3 20:15:11 CEST 2009


On Sun, May 3, 2009 at 6:36 PM, Wensui Liu <liuwensui at gmail.com> wrote:
> Sometimes, it is too costly to read the whole data file into R.
> I am looking for solution in scan() and read.Lines() but don't they work.

Try the following (assuming a 3 columns data file):

mydata <- read.table(file="myfile",header=T,colClasses=c(NA,"NULL",NA))

"NULL" indicates the column to be omitted.

Hope this helps you,

Paul




More information about the R-help mailing list