[R] Data import

Ben Bolker bbolker at gmail.com
Mon Sep 26 14:00:53 CEST 2011


B77S <bps0002 <at> auburn.edu> writes:

> 
> I have never used that function, but I know that with read.csv() you can do
> the following to select only the columns you want:
> 
> chosen_vars <- read.csv("Workbook1.csv", header=T)[c("variable1",
> "variable3")]
> 


  This is not actually selectively importing: it's importing the
whole thing and *then* selecting the relevant columns.
  If the original poster is trying to avoid importing the whole
data set because (for example) it's got a gigantic number of
columns and will be very slow and/or tax their system, then this
idiom won't help.

  Ben Bolker



More information about the R-help mailing list