Learn R Programming

linear.tools (version 1.3.0)

paste_formula: paste a formula as string

Description

paste a formula as string

Usage

paste_formula(Formula, exclude_y = FALSE, clean = FALSE)

Arguments

Formula
a formula to be pasted.
exclude_y
a boolean, whether to exclude y when paste. Default is FALSE.
clean
a boolean, whether to clean dirty formula: for example -- price ~ cut + carat - cut will be cleaned into price ~ carat. Default is FALSE.

Value

a pasted formula in string, with all spaces deleted.

Details

a pasted formula in string, with all spaces deleted. This function uses get_y and get_x behind the scene.

Examples

Run this code

paste_formula(price~carat +cut)
paste_formula(price~carat + cut)

paste_formula(price~carat +cut,exclude_y = TRUE)
paste_formula(Formula = price ~ cut + carat, clean = TRUE)

paste_formula(price~carat +cut - cut, clean = TRUE)

# irregular formulas: cross lines
paste_formula(price~carat +
                cut ~ dsad)

paste_formula(price~carat +
                cut ~ dsad,exclude_y = TRUE)

Run the code above in your browser using DataLab