[R] print selected variables

Don MacQueen macq at llnl.gov
Thu Aug 20 15:46:12 CEST 2009

If your data is in a data frame named "mydata" and you want to print 
the 3rd, 5th and 10th variables:

   mydata[ , c(3,5,10) ]


At 12:38 AM -0700 8/20/09, rajclinasia wrote:
>Hi every one,
>I read one excel external file into R, in that R dataset i have 20
>variables. now my querry is i want to print only selected variables (eg:10
>variables) with complete data. pls send me the code it will be very helpful
>for us.
>Thanks in Advance.
>View this message in context: 
>Sent from the R help mailing list archive at Nabble.com.
>R-help at r-project.org mailing list
>PLEASE do read the posting guide http://*www.*R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA

More information about the R-help mailing list