tidymodels / hardhat

Construct Modeling Packages
https://hardhat.tidymodels.org
Other
101 stars 16 forks source link

Document how to use an intercept only formula with hardhat #79

Closed DavisVaughan closed 5 years ago

DavisVaughan commented 5 years ago

Since we don't allow you to use +1.

library(hardhat)

mold(~NULL, iris)
#> $predictors
#> # A tibble: 150 x 0
#> 
#> $outcomes
#> # A tibble: 150 x 0
#> 
#> $engine
#> Formula Engine: 
#>  
#> # Predictors: 0 
#>   # Outcomes: 0 
#>    Intercept: FALSE 
#>   Indicators: TRUE 
#> 
#> $extras
#> $extras$offset
#> NULL

mold(~NULL, iris, engine = default_formula_engine(intercept = TRUE))
#> $predictors
#> # A tibble: 150 x 1
#>    `(Intercept)`
#>            <dbl>
#>  1             1
#>  2             1
#>  3             1
#>  4             1
#>  5             1
#>  6             1
#>  7             1
#>  8             1
#>  9             1
#> 10             1
#> # … with 140 more rows
#> 
#> $outcomes
#> # A tibble: 150 x 0
#> 
#> $engine
#> Formula Engine: 
#>  
#> # Predictors: 0 
#>   # Outcomes: 0 
#>    Intercept: TRUE 
#>   Indicators: TRUE 
#> 
#> $extras
#> $extras$offset
#> NULL

Created on 2019-03-11 by the reprex package (v0.2.1.9000)

github-actions[bot] commented 3 years ago

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.