fparse.Rd
Formula input from e.g., lm, may be extended to include mediators, quadratic and partial terms using a standard syntax. This is use by lmCor
and mediate
.
fparse(expr)
A list of elements from the left side of the formula
A list of elements from the right side of the formula
A list of those elements of the formula included in ()
A list of elements separated by a * sign
A list of elements marked by I()
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 lmCor
and mediate
.
fparse(DV ~ IV1 + IV2 * IV2*IV3 + (IV4) + I(IV5^2) )
#> $y
#> [1] "DV"
#>
#> $x
#> [1] "IV1" "IV2" "IV3" "IV4"
#>
#> $m
#> [1] "IV4"
#>
#> $prod
#> $prod[[1]]
#> [1] "IV2" "IV3"
#>
#>
#> $z
#> NULL
#>
#> $ex
#> [1] "IV5"
#>
#somewhat more complicated
fparse(DV1 + DV2 ~ IV1 + IV2 + IV3*IV4 + I(IV5^2) + I(Iv6^2) + (IV7) + (IV8) - IV9)
#> $y
#> [1] "DV1" "DV2"
#>
#> $x
#> [1] "IV1" "IV2" "IV3" "IV4" "IV7" "IV8"
#>
#> $m
#> [1] "IV7" "IV8"
#>
#> $prod
#> $prod[[1]]
#> [1] "IV3" "IV4"
#>
#>
#> $z
#> [1] "IV9"
#>
#> $ex
#> [1] "IV5" "Iv6"
#>