dropdata | R Documentation |
Allows for dropping observations (rows) determined by row names or factor levels from a data.frame or matrix.
dropdata(data, rowid = NULL, incol = "row.names", colid = NULL)
data |
a data.frame of matrix |
rowid |
vector of character strings identifying the rows to be dropped |
incol |
name or index of the column used to identify the observations (rows) |
colid |
vector of character strings identifying the columns to be dropped |
The data.frame or matrix without the dropped observations and/or variables. Attributes are passed on.
Ordinary subsetting by [...,...]
drops attributes like
doc
or tit
. Furthermore, the convenient
way to drop rows or columns by giving negative indices to
[...,...]
cannot be used with names of rows or columns.
Werner A. Stahel, ETH Zurich
subset
dd <- data.frame(rbind(a=1:3,b=4:6,c=7:9,d=10:12))
dropdata(dd,"b")
dropdata(dd, col="X3")
d1 <- dropdata(dd,"d")
d2 <- dropdata(d1,"b")
naresid(attr(d2,"na.action"),as.matrix(d2))
dropdata(letters, 3:5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.