CompadreDB-Subsetting | R Documentation |
CompadreDB
objects can be subset just like a regular
data.frame
, using either [
or subset()
. Note, however,
that the mat
column will always be retained during subsetting, even if
it is not included in the user's column subset.
## S4 method for signature 'CompadreDB,ANY,ANY,ANY'
x[i, j, ..., drop = FALSE]
## S3 method for class 'CompadreDB'
subset(x, subset, select, drop = FALSE, ...)
x |
A |
i |
row indices (see [.data.frame) |
j |
column indices (see [.data.frame) |
... |
ignored |
drop |
ignored |
subset |
logical expression indicating which rows to keep |
select |
expression indicating which columns to keep |
No return value, called for side effects
# subset to the first 10 rows
Compadre[1:10, ]
# subset to the species 'Echinacea angustifolia'
subset(Compadre, SpeciesAccepted == "Echinacea angustifolia")
# remove the column SurvivalIssue
Compadre[, names(Compadre) != "SurvivalIssue"]
## Not run:
# column selection doesn't include mat, but mat will still be returned with a
# along with a warning
subset(Compadre, select = c("SpeciesAccepted", "Authors"))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.