Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variable names with spaces label not being applied #77

Closed
ddsjoberg opened this issue Dec 3, 2020 · 1 comment
Closed

Variable names with spaces label not being applied #77

ddsjoberg opened this issue Dec 3, 2020 · 1 comment

Comments

@ddsjoberg
Copy link
Collaborator

Hey @larmarange !

I was making an update regarding variables with bad names (i.e. spaces, etc), and I noticed a small issue with the variable label. When a variable has a space in it, the variable label is correctly populated in the var_label column, but is not populated in the "label" column.

library(broom.helpers)
library(gtsummary)
#> #BlackLivesMatter
packageVersion("broom.helpers")
#> [1] '1.1.0'

# 'label' column does not have variable label
lm(response ~ `age at dx`, 
   data = trial %>% select(response, `age at dx` = age)) %>%
  tidy_plus_plus(
    variable_labels = list(`age at dx` = "AGGGGGGGE")
  ) %>%
  select(term, variable, var_label, label, estimate)
#> # A tibble: 1 x 5
#>   term        variable  var_label label       estimate
#>   <chr>       <chr>     <chr>     <chr>          <dbl>
#> 1 `age at dx` age at dx AGGGGGGGE `age at dx`  0.00402

# 'label' column is correct with normal name
lm(response ~ age, 
   data = trial) %>%
  tidy_plus_plus(
    variable_labels = list(age = "AGGGGGGGE")
  ) %>%
  select(term, variable, var_label, label, estimate)
#> # A tibble: 1 x 5
#>   term  variable var_label label     estimate
#>   <chr> <chr>    <chr>     <chr>        <dbl>
#> 1 age   age      AGGGGGGGE AGGGGGGGE  0.00402

Created on 2020-12-03 by the reprex package (v0.3.0)

@larmarange
Copy link
Owner

OK

some weird things with backtips. Should be fixed now:

library(broom.helpers)
library(gtsummary)
#> #BlackLivesMatter
#> 
#> Attachement du package : 'gtsummary'
#> The following objects are masked from 'package:broom.helpers':
#> 
#>     all_categorical, all_continuous, all_dichotomous
packageVersion("broom.helpers")
#> [1] '1.1.0.9000'

lm(response ~ `age at dx` + `drug type`, 
   data = trial %>% select(response, `age at dx` = age, `drug type` = trt)) %>%
  tidy_plus_plus(
    variable_labels = list(`age at dx` = "AGGGGGGGE")
  ) %>%
  select(term, variable, var_label, label, estimate)
#> # A tibble: 3 x 5
#>   term              variable  var_label              label     estimate
#>   <chr>             <chr>     <chr>                  <chr>        <dbl>
#> 1 `age at dx`       age at dx AGGGGGGGE              AGGGGGGGE  0.00402
#> 2 `drug type`Drug A drug type Chemotherapy Treatment Drug A     0      
#> 3 `drug type`Drug B drug type Chemotherapy Treatment Drug B     0.0265

lm(response ~ age, 
   data = trial) %>%
  tidy_plus_plus(
    variable_labels = list(age = "AGGGGGGGE")
  ) %>%
  select(term, variable, var_label, label, estimate)
#> # A tibble: 1 x 5
#>   term  variable var_label label     estimate
#>   <chr> <chr>    <chr>     <chr>        <dbl>
#> 1 age   age      AGGGGGGGE AGGGGGGGE  0.00402

Created on 2020-12-03 by the reprex package (v0.3.0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants