Learn R Programming

sasLM (version 0.5.0)

BY: Analysis BY variable

Description

GLM, REG, aov1 etc. functions can be run by levels of a variable.

Usage

BY(FUN, Formula, Data, By, ...)

Arguments

FUN

Function name to be called such as GLM, REG

Formula

a conventional formula for a linear model.

Data

a data.frame to be analyzed

By

a variable name in the Data

...

arguments to be passed to FUN function

Value

a list of FUN function outputs. The names are after each level.

Details

This mimics SAS procedues' BY clause.

Examples

Run this code
# NOT RUN {
BY(GLM, uptake ~ Treatment + as.factor(conc), CO2, By="Type")
BY(REG, uptake ~ conc, CO2, By="Type")
# }

Run the code above in your browser using DataLab