Learn R Programming

sasLM (version 1.0.1)

BY: Analysis BY variable

Description

Functions such as GLM, REG, and aov1 can be run by levels of a variable.

Usage

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

Value

a list of FUN function outputs. The names of the list are the levels of the By variable.

Arguments

FUN

Function name to be called, such as GLM or 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

Author

Kyun-Seop Bae k@acr.kr

Details

This mimics the BY clause of SAS procedures.

Examples

Run this code
  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