Learn R Programming

PKNCA (version 0.10.0)

parseFormula: Parse a formula into its component parts.

Description

This function supports parsing

Usage

parseFormula(form, require.groups = FALSE, require.two.sided = FALSE)

Value

A parseFormula class list with elements of

model

The left~right side of the model (excluding groups)

lhs

The call for the left hand side

rhs

The call for the right hand side (excluding groups)

groups

The call for the groups

groupFormula

A formula form of the groups

env

The original formula's environment

Arguments

form

the formula to extract into its parts

require.groups

is it an error not to have groups?

require.two.sided

is it an error to have a one-sided formula?

Details

This function extracts the left hand side (lhs), right hand side (rhs), groups (groups and as a formula, grpFormula), the environment (env, and the original left/right hand side of the model (model).

This function borrows heavily from the parseGroupFormula function in the doBy package.

See Also

Other Formula parsing: findOperator(), formula.parseFormula()

Examples

Run this code
parseFormula("a~b", require.groups=FALSE)
# parseFormula("a~b", require.groups=TRUE) # This is an error
parseFormula("a~b|c")
parseFormula("a~b|c")$groups

Run the code above in your browser using DataLab