[R] remove component from list or data frame

2007-02-08 Thread Jason Horn
Sorry to ask such a simple question, but I can't find the answer after extensive searching the docs and the web. How do you remove a component from a list? For example say you have: lst-c(5,6,7,8,9) How do you remove, for example, the third component in the list? lst[[3]]]-NULL generates

Re: [R] remove component from list or data frame

2007-02-08 Thread David Barron
The first example you provide is a vector, not a list. You can remove the third element with: lst[-3] [1] 5 6 8 9 The same thing works for rows of data frames: frame[-3,] lst1 lst2 116 227 449 55 10 On 08/02/07, Jason Horn [EMAIL PROTECTED]

Re: [R] remove component from list or data frame

2007-02-08 Thread Sarah Goslee
Hi Jason, On 2/8/07, Jason Horn [EMAIL PROTECTED] wrote: Sorry to ask such a simple question, but I can't find the answer after extensive searching the docs and the web. How do you remove a component from a list? For example say you have: You use the - operator for both your vector and

Re: [R] remove component from list or data frame

2007-02-08 Thread Henrique Dallazuanna
First: lst - lst[-3] Second: frame- frame[-2,] On 08/02/07, Jason Horn [EMAIL PROTECTED] wrote: Sorry to ask such a simple question, but I can't find the answer after extensive searching the docs and the web. How do you remove a component from a list? For example say you have:

Re: [R] remove component from list or data frame

2007-02-08 Thread Duncan Murdoch
On 2/8/2007 12:30 PM, Jason Horn wrote: Sorry to ask such a simple question, but I can't find the answer after extensive searching the docs and the web. How do you remove a component from a list? For example say you have: lst-c(5,6,7,8,9) In R jargon, that's a vector, not a list. How

Re: [R] remove component from list or data frame

2007-02-08 Thread Erik Iverson
Jason Horn wrote: Sorry to ask such a simple question, but I can't find the answer after extensive searching the docs and the web. How do you remove a component from a list? For example say you have: lst-c(5,6,7,8,9) How do you remove, for example, the third component in the list?

Re: [R] remove component from list or data frame

2007-02-08 Thread Duncan Murdoch
On 2/8/2007 1:09 PM, Duncan Murdoch wrote: On 2/8/2007 12:30 PM, Jason Horn wrote: Sorry to ask such a simple question, but I can't find the answer after extensive searching the docs and the web. How do you remove a component from a list? For example say you have: lst-c(5,6,7,8,9) In