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 returning a valid CompadreDB object requires the mat column. If a column subset excludes mat, a plain tabular object is returned instead of a CompadreDB.

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"]

subset(Compadre, select = c("SpeciesAccepted", "Authors"))

Rcompadre documentation built on April 23, 2026, 9:08 a.m.