Re: [R] Indexing a list with a list

2009-06-26 Thread Henrique Dallazuanna
You have four elements in ind and three elements in example, then, try this mapply('[', example, ind[1:3]) On Fri, Jun 26, 2009 at 3:27 PM, Greg Hirson wrote: > Dear list, > > I have two lists: one with data and one with TRUE/FALSE values for data I > want to further analyze (see example below)

Re: [R] Indexing a list with a list

2009-06-26 Thread Greg Hirson
Jim, Thank you for your help. I had a feeling it would be an apply function that could help. Kind regards, Greg jim holtman wrote: Your example has one more element in 'ind' than 'example' and that is what causes the error, but this should be close. > #sample data > set.seed(100) > examp

Re: [R] Indexing a list with a list

2009-06-26 Thread jim holtman
Your example has one more element in 'ind' than 'example' and that is what causes the error, but this should be close. > #sample data > set.seed(100) > example = list(letters[1:10], letters[1:10], letters[1:10]) > ind = list(as.logical(sample(0:1, 10, rep=TRUE)), +as.logical(sample(0:1