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 1 1 6 2 2 7 4 4 9 5 5 10 > > > 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: > > > > lst<-c(5,6,7,8,9) > > > > How do you remove, for example, the third component in the list? > > > > lst[[3]]]<-NULL generates an error: "Error: more elements supplied > > than there are to replace" > > > > > > > > Also, how do you remove a row from a data frame? For example, say you > > have: > > > > lst1<-c(1,2,3,4,5) > > lst2<-c(6,7,8,9,10) > > frame<-data.frame(lst1,lst2) > > > > How do you remove, for example, the second row of frame? > > > > Thanks, > > > > - Jason > > > > ______________________________________________ > > R-help@stat.math.ethz.ch 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. > > > > > > -- > ================================= > David Barron > Said Business School > University of Oxford > Park End Street > Oxford OX1 1HP -- ================================= David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP ______________________________________________ R-help@stat.math.ethz.ch 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.