get y (right hand of var)

Share:

Description

get y (right hand of var)

Usage

1
get_y(Formula, method = c("raw", "model", "coeff"))

Arguments

Formula

a formula to be paste.

method

either 'raw','model', or 'coeff', to decide what kind variables to show. Default is 'raw'. See section Detials below.

Details

What do 'raw' variable, 'model' variable, and 'coeff' variable mean?

  • raw var is the underlying variable without any calculation or transformation.

  • model var is the underlying variable with calculations or transformation.

  • coeff var is the coefficient variable in the model output. So only evaluated model has coeff var.

In the formula, log(y) ~ x1 + x2, we have: 'raw' variable for y: y 'model' variable for y: log(y) 'coeff' variable for y: log(y)

More examples see the sample code below.

Value

y in formula

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
get_y(log(price) ~sdfsf + dsa )
get_y(log(price) ~ sdfsf + dsa, method = "model")
get_y(log(price) ~ sdfsf + dsa, method = "coeff") # same as model var in the get_y() case

# can deal with un-regular formula
get_y(log(price) ~sdfsf + dsa ~ dsad)
get_y(log(price) ~ sdfsf + dsa ~ dsad, method = "coeff")
get_y(log(price) ~ sdfsf + dsa ~ dsad, method = "model")

model_dirty = model = lm(price~  I(carat^   2) + cut  - carat:table - cut ,ggplot2::diamonds)
get_y(model_dirty)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.