Function to make groupwise transformations

R doBy

transformBy(doBy)R Documentation

Function to make groupwise transformations

Description

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

Usage

transformBy(formula, data, ...)

Arguments

formula A formula with only a right hand side, see examples below
data A data frame
... 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, [email protected]

See Also

orderBy, summaryBy, splitBy, doby.xtabs,

Examples


data(dietox)
transformBy(~Pig, data=dietox, minW=min(Weight), maxW=max(Weight), 
    gain=sum(range(Weight)*c(-1,1)))


[Package doBy version 1.9 Index]