Re: [R] Accessing elements of a list

2011-05-25 Thread David Winsemius
On May 25, 2011, at 3:25 PM, Seth W Bigelow wrote: I have a list that is made of lists of varying length. I wish to create a new vector that contains the last element of each list. So far I have used sapply to determine the length of each list, but I'm stymied at the part where I index the

Re: [R] Accessing elements of a list

2011-05-25 Thread Marc Schwartz
On May 25, 2011, at 2:25 PM, Seth W Bigelow wrote: > I have a list that is made of lists of varying length. I wish to create a > new vector that contains the last element of each list. So far I have used > sapply to determine the length of each list, but I'm stymied at the part > where I index

Re: [R] Accessing elements of a list

2011-05-25 Thread David Winsemius
On May 25, 2011, at 3:25 PM, Seth W Bigelow wrote: I have a list that is made of lists of varying length. I wish to create a new vector that contains the last element of each list. So far I have used sapply to determine the length of each list, but I'm stymied at the part where I index the

[R] Accessing elements of a list

2011-05-25 Thread Seth W Bigelow
I have a list that is made of lists of varying length. I wish to create a new vector that contains the last element of each list. So far I have used sapply to determine the length of each list, but I'm stymied at the part where I index the list to make a new vector containing only the last item