Closed larmarange closed 2 years ago
Currently, the include parameter preserves the original order of the variables.
include
library(broom.helpers) mod <- lm(Sepal.Length ~ ., data = iris) mod |> tidy_plus_plus() |> dplyr::select(term, variable, label, estimate) #> # A tibble: 6 × 4 #> term variable label estimate #> <chr> <chr> <chr> <dbl> #> 1 Sepal.Width Sepal.Width Sepal.Width 0.496 #> 2 Petal.Length Petal.Length Petal.Length 0.829 #> 3 Petal.Width Petal.Width Petal.Width -0.315 #> 4 Speciessetosa Species setosa 0 #> 5 Speciesversicolor Species versicolor -0.724 #> 6 Speciesvirginica Species virginica -1.02 mod |> tidy_plus_plus(include = c(Species, Petal.Length)) |> dplyr::select(term, variable, label, estimate) #> # A tibble: 4 × 4 #> term variable label estimate #> <chr> <chr> <chr> <dbl> #> 1 Petal.Length Petal.Length Petal.Length 0.829 #> 2 Speciessetosa Species setosa 0 #> 3 Speciesversicolor Species versicolor -0.724 #> 4 Speciesvirginica Species virginica -1.02 mod |> tidy_plus_plus(include = c(Species, Petal.Length, everything())) |> dplyr::select(term, variable, label, estimate) #> # A tibble: 6 × 4 #> term variable label estimate #> <chr> <chr> <chr> <dbl> #> 1 Sepal.Width Sepal.Width Sepal.Width 0.496 #> 2 Petal.Length Petal.Length Petal.Length 0.829 #> 3 Petal.Width Petal.Width Petal.Width -0.315 #> 4 Speciessetosa Species setosa 0 #> 5 Speciesversicolor Species versicolor -0.724 #> 6 Speciesvirginica Species virginica -1.02
Created on 2022-10-07 with reprex v2.0.2
To be consistent with dplyr::select(), should the table be reordered according to the include parameters?
dplyr::select()
@ddsjoberg do you have an advice about it?
Oh good point. I think it would be preferable to have the order adjusted with include= if it's not too hairy to make happen.
include=
I will explore it
It is finally not too complicated to do it. See #184
Currently, the
include
parameter preserves the original order of the variables.Created on 2022-10-07 with reprex v2.0.2
To be consistent with
dplyr::select()
, should the table be reordered according to theinclude
parameters?@ddsjoberg do you have an advice about it?