[R] Equivalent to Stata command

Marc Schwartz marc_schwartz at comcast.net
Sat Nov 4 17:22:11 CET 2006


On Sat, 2006-11-04 at 15:57 +0000, Jon Minton wrote:
> Hi:

> Do any of you know if there's an equivalent function to the Stata command:

> Use v1 v3 v5 v2 v7 using file.dat

> In R? (i.e. something that just selectively loads certain variables from a
> file and not others)?

See ?read.table and note the 'colClasses' argument, which allows you to
set a "NULL" value to columns that should be skipped.

Alternatively, you can do a post import column selection using ?subset.

The appropriate solution may be dependent upon whether you are RAM
constrained and/or whether the columns to be skipped are easier to
define than the columns to be selected.

HTH,

Marc Schwartz



More information about the R-help mailing list