list
that contains a subset of the components of the supplied
list
.Select components of a list
specified by a list of numbers or names,
or by a logical indicating for each component of the list whether or not it is to
be retained.
# S3 method for list
subset(x, select = 1:length(x), ...)
A list
with just the subset of the components from x
. If the
components of x
are named, then these names are retained in the subset
list
.
An list
object.
A numeric
or character
that lists or names the
components of the list
x
that are to be retained in the
subset. It can also be a logical
that is the same length as
x
and indicates whether or not a component is to be retained.
further arguments passed to or from other methods. Not used at present.
Chris Brien
subset.alldiffs
x <- list(1:3,letters[1:3],LETTERS[1:3])
y <- subset.list(x, select = c(1,3))
y <- subset.list(x, select = c(TRUE,FALSE,TRUE))
names(x) <- LETTERS[1:3]
y <- subset.list(x, select = c(1,3))
z <- subset.list(x, select = LETTERS[c(1,3)])
x <- list(1:3,letters[1:3],LETTERS[1:3])
names(x)[c(1,3)] <- LETTERS[c(1,3)]
z <- subset.list(x, select = c(1,2))
v <- subset.list(x)
Run the code above in your browser using DataLab