Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

fparse

Parse and exten formula input from a model and return the DV, IV, and associated terms.


Description

Formula input from e.g., lm, may be extended to include mediators, quadratic and partial terms using a standard syntax. This is use by setCor and mediate.

Usage

fparse(expr)

Arguments

expr

A legitimate expression in the form y ~ x1 , etc. (see details)

Details

The basic formula input given as DV1 + DV2 ~ IV1 + IV2 + (IV3) + I(IV4^2) - IV5 will be parsed to return 2 DVs (1 and 2), two normal IVs (1 and 2), a mediator (IV3) a quadratic (IV4) and a variable to be partialed (IV5). See the various examples in setCor and mediate.

Value

y

A list of elements from the left side of the formula

x

A list of elements from the right side of the formula

m

A list of those elements of the formula included in ()

prod

A list of elements separated by a * sign

ex

A list of elements marked by I()

Author(s)

William Revelle

Examples

fparse(DV  ~ IV1 + IV2 * IV2*IV3 + (IV4) + I(IV5^2) )
#somewhat more complicated
fparse(DV1 + DV2 ~ IV1 + IV2 + IV3*IV4 + I(IV5^2) + I(Iv6^2) + (IV7) + (IV8) - IV9)

psych

Procedures for Psychological, Psychometric, and Personality Research

v2.1.3
GPL (>= 2)
Authors
William Revelle [aut, cre] (<https://orcid.org/0000-0003-4880-9610>)
Initial release
2021-03-21

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.