Re: [R] Subsetting a list

From: John Wilkinson (pipex) <>
Date: Wed 19 Oct 2005 - 21:00:53 EST

Dennis ----


> TEST[-3]

[1] "A1" "A2"

[1] "B1" "B2"

for removing more than one element from the list (say 2 & 3) --

> TEST[-c(2,3)]

[1] "A1" "A2"

HTH John

Dennis Fisher wrote---


I have created a list in the following manner:

     TEST <- list(c("A1", "A2"), c("B1", "B2"), c("C1", "C2"))

I now want to delete one element from the list, e.g., the third. The command

yields (as expected):

     [1] "C1" "C2"

The command


     Error: attempt to select more than one element

How can I accomplish delete one or more elements from this list?

I am running R2.2.0 on a Linux platform.

Dennis mailing list PLEASE do read the posting guide! Received on Wed Oct 19 21:02:14 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 19:06:08 EST