Skip to content
Back to formatted view

Raw Message

Message-ID: <6ade6f6c0905031115y3337b5f9m28977d6efa11fd59@mail.gmail.com>
Date: 2009-05-03T18:15:11Z
From: Paul Smith
Subject: is there a way to read a specific column from a txt file
In-Reply-To: <1115a2b00905031036p7020e2beoa212eba594317a07@mail.gmail.com>

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