CompadreDB-Subsetting: Subsetting CompadreDB objects

CompadreDB-SubsettingR Documentation

Subsetting CompadreDB objects

Description

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.

Usage

## S4 method for signature 'CompadreDB,ANY,ANY,ANY'
x[i, j, ..., drop = FALSE]

## S3 method for class 'CompadreDB'
subset(x, subset, select, drop = FALSE, ...)

Arguments

x

A CompadreDB object

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

Value

No return value, called for side effects

Examples

# 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)

Rcompadre documentation built on Oct. 17, 2024, 1:07 a.m.