Hi Arun:
Exactly. That's exactly what I'm looking for!
On 2012-11-12, at 5:55 PM, arun kirshna [via R] wrote:

> Hi, 
> Seems like there was a typo in "mylist" 
> mylist<-list(df1=data.frame(a=seq(1,10,1), c=seq(1,10,1), q10=rep('favour', 
> 10)), df2=data.frame(a=seq(1,10,1), b=seq(15,24,1), q14=rep('favour', 10))) 
> Are you looking for something like this? 
>  lapply(mylist,function(x) x[colnames(x)%in% c("a","q10","q14")]) 
> #$df1 
>   #  a    q10 
> #1   1 favour 
> #2   2 favour 
> #3   3 favour 
> #4   4 favour 
> #5   5 favour 
> #6   6 favour 
> #7   7 favour 
> #8   8 favour 
> #9   9 favour 
> #10 10 favour 
> 
> #$df2 
>   #  a    q14 
> #1   1 favour 
> #2   2 favour 
> #3   3 favour 
> #4   4 favour 
> #5   5 favour 
> #6   6 favour 
> #7   7 favour 
> #8   8 favour 
> #9   9 favour 
> #10 10 favour 
> A.K. 
> 
> If you reply to this email, your message will be added to the discussion 
> below:
> http://r.789695.n4.nabble.com/select-different-variables-from-a-list-of-data-frames-tp4649342p4649343.html
> This email was sent by arun kirshna (via Nabble)
> To receive all replies by email, subscribe to this discussion

*********************************
Simon J. Kiss, PhD
Assistant Professor, Wilfrid Laurier University
73 George Street
Brantford, Ontario, Canada
N3T 2C9
Cell: +1 905 746 7606

Please avoid sending me Word, PowerPoint or Excel attachments. Sending these 
documents puts pressure on many people to use Microsoft software and helps to 
deny them any other choice. In effect, you become a buttress of the Microsoft 
monopoly.

To convert to plain text choose Text Only or Text Document as the Save As Type. 
 Your computer may also have a program to convert to PDF format. Select File, 
then Print. Scroll through available printers and select the PDF converter. 
Click on the Print button and enter a name for the PDF file when requested.















--
View this message in context: 
http://r.789695.n4.nabble.com/select-different-variables-from-a-list-of-data-frames-tp4649342p4649344.html
Sent from the R help mailing list archive at Nabble.com.
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

Reply via email to