by.exdf: Apply a function to an exdf object split by one or more...

View source: R/exdf.R

by.exdfR Documentation

Apply a function to an exdf object split by one or more factors

Description

Divides an exdf object into groups defined by one or more factors and applies a function to each group.

Usage

  ## S3 method for class 'exdf'
by(data, INDICES, FUN, ...)

Arguments

data

An exdf object.

INDICES

A factor or a list of factors.

FUN

A function whose first input argument is an exdf object.

...

Additional arguments to be passed to FUN.

Value

Splits data into chunks x by the values of the INDICES and calls FUN(x, ...) for each chunk; returns a list where each element is the output from each call to FUN.

See Also

exdf

Examples

# Read a Licor file, split it into chunks according to the `species` column,
# and count the number of measurements for each species
licor_file <- read_gasex_file(
  PhotoGEA_example_file_path('ball_berry_1.xlsx')
)

by(licor_file, licor_file[, 'species'], nrow)

PhotoGEA documentation built on June 12, 2025, 5:08 p.m.