Re: [R] extracting columns from a list

2008-05-23 Thread Vincent Goulet
Le ven. 23 mai à 09:37, mohamed nur anisah a écrit : Dear all, i have 2 lists of data with each of the list contain 14 columns. No, you have one list with two elements; each is a 14-column data frame. How am i going to extract column 12 and 13 from each of the list ?? Let's call your lis

Re: [R] extracting columns from a list

2008-05-23 Thread N. Lapidus
I forgot to answer to the last part of your question. I think what you call a list is actually an element of a list, right? If so, the command you want depends on the way you want to combine these elements. For example, the following lines will extract columns 12 and 13 of any array-like element o

Re: [R] extracting columns from a list

2008-05-23 Thread N. Lapidus
Hi Mohamed Try: lapply (NameOfYourList, function (dat, NumCol) dat[,NumCol], c(12,13)) But there must be a shorter way to write this. Nael On Fri, May 23, 2008 at 3:37 PM, mohamed nur anisah < [EMAIL PROTECTED]> wrote: > Dear all, > > i have 2 lists of data with each of the list contain 14 c

[R] extracting columns from a list

2008-05-23 Thread mohamed nur anisah
Dear all, i have 2 lists of data with each of the list contain 14 columns. How am i going to extract column 12 and 13 from each of the list ?? and can i combine my extracted columns to form a single list. Attach with are my data. Your coorperation is highly appreciated. Many thanks R