[R] Equivalent to Stata command
Jon Minton
gsp05jm at sheffield.ac.uk
Sat Nov 4 17:34:00 CET 2006
Thanks, that's the kind of hint I was looking for: the types of data I'm
using (survey responses) generally contain hundreds of variables, of which
I'm typically only looking to extract about 5 or so (hence the 'load
everything then subset' approach being less than ideal...)
Jon
-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Marc Schwartz
Sent: 04 November 2006 16:22
To: Jon Minton
Cc: R-help at stat.math.ethz.ch
Subject: Re: [R] Equivalent to Stata command
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
______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list