[R] subsetting dataframe by rownames to be excluded
Dieter Menne
dieter.menne at menne-biomed.de
Mon Oct 13 11:36:55 CEST 2008
Prof Brian Ripley <ripley <at> stats.ox.ac.uk> writes:
> Yes: DF[is.na(match(row.names(DF), exclude_me)), ]
Assuming everything is possible in R: would it be possible to make the below
work without breaking existing code?
a <- data.frame(x=1:10)
rownames(a) = letters[1:10]
exclude = c("a","c")
a[is.na(match(row.names(a), exclude)), ] # not really that easy to remember
a[-c(1,3),]
# In analogy....
a[-c(exclude),] #invalid argument to unary operator
Dieter
More information about the R-help
mailing list