[R] how to eliminate an element of a list

fishkbob fishkbob at gmail.com
Fri Aug 13 22:02:21 CEST 2010


Try to do this

> list <- seq(1,5,1) 
> list<-list[-3]
> list
[1] 1 2 4 5

list[-x] will remove the xth value in your list. Also you can do something
like

> list[-c(1:4)]
[1] 5
To remove values at indexes 1-4

> list[-c(1,4)]
[1] 2 3 5
To remove values at indexes 1 and 4
-- 
View this message in context: http://r.789695.n4.nabble.com/how-to-eliminate-an-element-of-a-list-tp2323329p2324691.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list