by-transform: Function to make groupwise transformations

by-transformR Documentation

Function to make groupwise transformations

Description

Function to make groupwise transformations of data by applying the transform function to subsets of data.

Usage

transform_by(data, formula, ...)

transformBy(formula, data, ...)

Arguments

data

A data frame

formula

A formula with only a right hand side, see examples below

...

Further arguments of the form tag=value

Details

The ... arguments are tagged vector expressions, which are evaluated in the data frame data. The tags are matched against names(data), and for those that match, the value replace the corresponding variable in data, and the others are appended to data.

Value

The modified value of the dataframe data.

Author(s)

Søren Højsgaard, sorenh@math.aau.dk

See Also

orderBy, order_by, summaryBy, summary_by, splitBy, split_by

Examples

 
data(dietox)
transformBy(~Pig, data=dietox, minW=min(Weight), maxW=max(Weight), 
    gain=diff(range(Weight)))


doBy documentation built on Oct. 8, 2024, 1:06 a.m.