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

Bug Report: theme_gtsummary_journal(journal = "lancet") theme not working #1146

Closed
gorkang opened this issue Feb 8, 2022 · 28 comments · Fixed by #1156
Closed

Bug Report: theme_gtsummary_journal(journal = "lancet") theme not working #1146

gorkang opened this issue Feb 8, 2022 · 28 comments · Fixed by #1156
Milestone

Comments

@gorkang
Copy link
Contributor

gorkang commented Feb 8, 2022

I was trying out the theme_gtsummary_journal() function and when using the "lancet" theme I get this error:

gtsummary::theme_gtsummary_journal(journal = "lancet")
#> Setting theme `The Lancet`
model = lm(mpg ~ cyl, mtcars)
gtsummary::tbl_regression(model)
#> Error in `mutate_cols()`:
#> ! Problem with `mutate()` column `ci`.
#> ℹ `ci = if_else(...)`.
#> x invalid multibyte string, element 1
#> Caused by error in `nchar()`:
#> ! invalid multibyte string, element 1

Created on 2022-02-08 by the reprex package (v2.0.1)

@gorkang
Copy link
Contributor Author

gorkang commented Feb 8, 2022

Also, and probably arising from the lancet error (?), there are some order effects, causing the qjecon theme to fail when is run after the (failing) lancet theme.

library(dplyr)
model = lm(mpg ~ cyl + wt, mtcars)

# qjecon fails after lancet --------------
gtsummary::theme_gtsummary_journal(journal = "lancet")
#> Setting theme `The Lancet`
gtsummary::theme_gtsummary_journal(journal = "qjecon")
#> Setting theme `The Quareterly Journal of Economics`
gtsummary::tbl_regression(model) %>% gtsummary::as_kable(format = "markdown")
#> Error in nchar(x, "c"): invalid multibyte string, element 1

# qjecon works after jama --------------
gtsummary::theme_gtsummary_journal(journal = "jama")
#> Setting theme `JAMA`
gtsummary::theme_gtsummary_journal(journal = "qjecon")
#> Setting theme `The Quareterly Journal of Economics`
gtsummary::tbl_regression(model) %>% gtsummary::as_kable(format = "markdown")
Characteristic Beta (SE)
cyl -1.5**
(0.415)
wt -3.2***
(0.757)
# qjecon works after lancet if we reset_gtsummary_theme() --------------
gtsummary::theme_gtsummary_journal(journal = "lancet")
#> Setting theme `The Lancet`

gtsummary::reset_gtsummary_theme()
gtsummary::theme_gtsummary_journal(journal = "qjecon")
#> Setting theme `The Quareterly Journal of Economics`
gtsummary::tbl_regression(model) %>% gtsummary::as_kable(format = "markdown")
Characteristic Beta (SE)
cyl -1.5**
(0.415)
wt -3.2***
(0.757)

Created on 2022-02-08 by the reprex package (v2.0.1)

@ddsjoberg
Copy link
Owner

ddsjoberg commented Feb 8, 2022

Thanks @gorkang !

This code works on my machine.

library(gtsummary)
#> #BlackLivesMatter
packageVersion("gtsummary")
#> [1] '1.5.2.9002'

theme_gtsummary_journal(journal = "lancet")
#> Setting theme `The Lancet`
model = lm(mpg ~ cyl, mtcars)
tbl_regression(model) %>% as_kable() 
Characteristic Beta 95% CI p-value
cyl -2·9 -3·5 to -2·2 <0·001

Created on 2022-02-08 by the reprex package (v2.0.1)

Can you try a couple of things?

  1. Can you add your code to a proper reprex that runs in a fresh environment, and print the version number of gtsumaary into the console?
  2. Can you, in a fresh R session with no other R sessions open, re-install the package and try again?
  3. If neither of those things work, can you post a reprex with your session info?

Thanks!

@gorkang
Copy link
Contributor Author

gorkang commented Feb 8, 2022

I tried what you suggested, and updated my gtsummary version to the Github one, without luck.

This is the reprex with session info.

# remotes::install_github("ddsjoberg/gtsummary")
library(gtsummary)
packageVersion("gtsummary")
#> [1] '1.5.2.9002'

theme_gtsummary_journal(journal = "lancet")
#> Setting theme `The Lancet`
model = lm(mpg ~ cyl, mtcars)
tbl_regression(model) %>% as_kable()
#> Error in `mutate()`:
#> ! Problem while computing `ci = if_else(...)`.
#> Caused by error in `nchar()`:
#> ! invalid multibyte string, element 1

Created on 2022-02-08 by the reprex package (v2.0.1)

Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.1.2 (2021-11-01)
#>  os       Ubuntu 20.04.3 LTS
#>  system   x86_64, linux-gnu
#>  ui       X11
#>  language (EN)
#>  collate  en_US.UTF-8
#>  ctype    en_US.UTF-8
#>  tz       Atlantic/Canary
#>  date     2022-02-08
#>  pandoc   2.14.0.3 @ /usr/lib/rstudio/bin/pandoc/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package       * version    date (UTC) lib source
#>  assertthat      0.2.1      2019-03-21 [1] CRAN (R 4.1.1)
#>  backports       1.4.1      2021-12-13 [1] CRAN (R 4.1.2)
#>  broom           0.7.12     2022-01-28 [1] CRAN (R 4.1.2)
#>  broom.helpers   1.6.0      2022-01-12 [1] CRAN (R 4.1.2)
#>  cli             3.1.1      2022-01-20 [1] CRAN (R 4.1.2)
#>  colorspace      2.0-2      2021-06-24 [1] CRAN (R 4.1.1)
#>  crayon          1.4.2      2021-10-29 [1] CRAN (R 4.1.1)
#>  DBI             1.1.2      2021-12-20 [1] CRAN (R 4.1.2)
#>  digest          0.6.29     2021-12-01 [1] CRAN (R 4.1.2)
#>  dplyr           1.0.8      2022-02-08 [1] CRAN (R 4.1.2)
#>  ellipsis        0.3.2      2021-04-29 [1] CRAN (R 4.1.1)
#>  evaluate        0.14       2019-05-28 [1] CRAN (R 4.1.1)
#>  fansi           1.0.2      2022-01-14 [1] CRAN (R 4.1.2)
#>  fastmap         1.1.0      2021-01-25 [1] CRAN (R 4.1.1)
#>  forcats         0.5.1      2021-01-27 [1] CRAN (R 4.1.1)
#>  fs              1.5.2      2021-12-08 [1] CRAN (R 4.1.2)
#>  generics        0.1.2      2022-01-31 [1] CRAN (R 4.1.2)
#>  ggplot2         3.3.5      2021-06-25 [1] CRAN (R 4.1.1)
#>  glue            1.6.1      2022-01-22 [1] CRAN (R 4.1.2)
#>  gt              0.3.1      2021-08-07 [1] CRAN (R 4.1.1)
#>  gtable          0.3.0      2019-03-25 [1] CRAN (R 4.1.1)
#>  gtsummary     * 1.5.2.9002 2022-02-08 [1] Github (ddsjoberg/gtsummary@4308067)
#>  haven           2.4.3      2021-08-04 [1] CRAN (R 4.1.1)
#>  highr           0.9        2021-04-16 [1] CRAN (R 4.1.1)
#>  hms             1.1.1      2021-09-26 [1] CRAN (R 4.1.1)
#>  htmltools       0.5.2      2021-08-25 [1] CRAN (R 4.1.1)
#>  knitr           1.37       2021-12-16 [1] CRAN (R 4.1.2)
#>  labelled        2.9.0      2021-10-29 [1] CRAN (R 4.1.1)
#>  lifecycle       1.0.1      2021-09-24 [1] CRAN (R 4.1.1)
#>  magrittr        2.0.2      2022-01-26 [1] CRAN (R 4.1.2)
#>  munsell         0.5.0      2018-06-12 [1] CRAN (R 4.1.1)
#>  pillar          1.7.0      2022-02-01 [1] CRAN (R 4.1.2)
#>  pkgconfig       2.0.3      2019-09-22 [1] CRAN (R 4.1.1)
#>  purrr           0.3.4      2020-04-17 [1] CRAN (R 4.1.1)
#>  R.cache         0.15.0     2021-04-30 [1] CRAN (R 4.1.1)
#>  R.methodsS3     1.8.1      2020-08-26 [1] CRAN (R 4.1.1)
#>  R.oo            1.24.0     2020-08-26 [1] CRAN (R 4.1.1)
#>  R.utils         2.11.0     2021-09-26 [1] CRAN (R 4.1.1)
#>  R6              2.5.1      2021-08-19 [1] CRAN (R 4.1.1)
#>  reprex          2.0.1      2021-08-05 [1] CRAN (R 4.1.1)
#>  rlang           1.0.1      2022-02-03 [1] CRAN (R 4.1.2)
#>  rmarkdown       2.11       2021-09-14 [1] CRAN (R 4.1.1)
#>  rstudioapi      0.13       2020-11-12 [1] CRAN (R 4.1.1)
#>  scales          1.1.1      2020-05-11 [1] CRAN (R 4.1.1)
#>  sessioninfo     1.2.2      2021-12-06 [1] CRAN (R 4.1.2)
#>  stringi         1.7.6      2021-11-29 [1] CRAN (R 4.1.2)
#>  stringr         1.4.0      2019-02-10 [1] CRAN (R 4.1.1)
#>  styler          1.6.2      2021-09-23 [1] CRAN (R 4.1.2)
#>  tibble          3.1.6      2021-11-07 [1] CRAN (R 4.1.1)
#>  tidyr           1.2.0      2022-02-01 [1] CRAN (R 4.1.2)
#>  tidyselect      1.1.1      2021-04-30 [1] CRAN (R 4.1.1)
#>  utf8            1.2.2      2021-07-24 [1] CRAN (R 4.1.1)
#>  vctrs           0.3.8      2021-04-29 [1] CRAN (R 4.1.1)
#>  withr           2.4.3      2021-11-30 [1] CRAN (R 4.1.2)
#>  xfun            0.29       2021-12-14 [1] CRAN (R 4.1.2)
#>  yaml            2.2.2      2022-01-25 [1] CRAN (R 4.1.2)
#> 
#>  [1] /home/emrys/R/x86_64-pc-linux-gnu-library/4.1
#>  [2] /usr/local/lib/R/site-library
#>  [3] /usr/lib/R/site-library
#>  [4] /usr/lib/R/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────

@ddsjoberg
Copy link
Owner

HMmm, that is strange that it's working on my machine, but not yours. It looks like the error is presenting in this code chunk

table_body <-
      table_body %>%
      mutate( # adding character CI
        ci = if_else(
          !is.na(.data$conf.low),
          paste0(estimate_fun(.data$conf.low), ci.sep, estimate_fun(.data$conf.high)),
          NA_character_
        )
      ) %>%
      dplyr::relocate(any_of("ci"), .after = "conf.high")

I added additional messaging to this branch...can you install and run the reprex again?

remotes::install_github("ddsjoberg/gtsummary@gorkang")

Can you also show me these results?

theme_gtsummary_journal(journal = "lancet")
gtsummary:::get_theme_element("pkgwide-str:ci.sep", default = ", ")

Thanks

@gorkang
Copy link
Contributor Author

gorkang commented Feb 8, 2022

Here it is!

Maybe there is a difference in one of the dependencies version? I just installed the dev version of broom.helpers, but that didn't help either.

remotes::install_github("ddsjoberg/gtsummary@gorkang")
#> Downloading GitHub repo ddsjoberg/gtsummary@gorkang
#> 
#> * checking for file ‘/tmp/Rtmpuxw2mZ/remotes2df422ede0423/ddsjoberg-gtsummary-753b552/DESCRIPTION’ ... OK
#> * preparing ‘gtsummary’:
#> * checking DESCRIPTION meta-information ... OK
#> * installing the package to process help pages
#> * checking for LF line-endings in source and make files and shell scripts
#> * checking for empty or unneeded directories
#> * building ‘gtsummary_1.5.2.9002.tar.gz’
#> Installing package into '/home/emrys/R/x86_64-pc-linux-gnu-library/4.1'
#> (as 'lib' is unspecified)
#> Adding 'gtsummary_1.5.2.9002_R_x86_64-pc-linux-gnu.tar.gz' to the cache
  
library(gtsummary)
packageVersion("gtsummary")
#> [1] '1.5.2.9002'

theme_gtsummary_journal(journal = "lancet")
#> Setting theme `The Lancet`
model = lm(mpg ~ cyl, mtcars)
tbl_regression(model) %>% as_kable() 
#> ci.sep = ' to '
#> # A tibble: 1 × 8
#>   variable row_type var_label reference_row label estimate conf.low conf.high
#>   <chr>    <chr>    <chr>     <lgl>         <chr>    <dbl>    <dbl>     <dbl>
#> 1 cyl      label    cyl       NA            cyl      -2.88    -3.53     -2.22
#> Error in `mutate()`:
#> ! Problem while computing `ci = if_else(...)`.
#> Caused by error in `nchar()`:
#> ! invalid multibyte string, element 1

theme_gtsummary_journal(journal = "lancet")
#> Setting theme `The Lancet`
gtsummary:::get_theme_element("pkgwide-str:ci.sep", default = ", ")
#> [1] " to "

Created on 2022-02-08 by the reprex package (v2.0.1)

Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.1.2 (2021-11-01)
#>  os       Ubuntu 20.04.3 LTS
#>  system   x86_64, linux-gnu
#>  ui       X11
#>  language (EN)
#>  collate  en_US.UTF-8
#>  ctype    en_US.UTF-8
#>  tz       Atlantic/Canary
#>  date     2022-02-08
#>  pandoc   2.14.0.3 @ /usr/lib/rstudio/bin/pandoc/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package       * version    date (UTC) lib source
#>  assertthat      0.2.1      2019-03-21 [1] CRAN (R 4.1.1)
#>  backports       1.4.1      2021-12-13 [1] CRAN (R 4.1.2)
#>  bit             4.0.4      2020-08-04 [1] CRAN (R 4.1.1)
#>  bit64           4.0.5      2020-08-30 [1] CRAN (R 4.1.1)
#>  blob            1.2.2      2021-07-23 [1] CRAN (R 4.1.1)
#>  broom           0.7.12     2022-01-28 [1] CRAN (R 4.1.2)
#>  broom.helpers   1.6.0      2022-01-12 [1] CRAN (R 4.1.2)
#>  cachem          1.0.6      2021-08-19 [1] CRAN (R 4.1.1)
#>  callr           3.7.0      2021-04-20 [1] CRAN (R 4.1.1)
#>  cli             3.1.1      2022-01-20 [1] CRAN (R 4.1.2)
#>  colorspace      2.0-2      2021-06-24 [1] CRAN (R 4.1.1)
#>  crancache       0.0.0.9001 2021-12-18 [1] Github (r-lib/crancache@7ea4e47)
#>  cranlike        1.0.2      2018-11-26 [1] CRAN (R 4.1.2)
#>  crayon          1.4.2      2021-10-29 [1] CRAN (R 4.1.1)
#>  curl            4.3.2      2021-06-23 [1] CRAN (R 4.1.1)
#>  DBI             1.1.2      2021-12-20 [1] CRAN (R 4.1.2)
#>  debugme         1.1.0      2017-10-22 [1] CRAN (R 4.1.1)
#>  desc            1.4.0      2021-09-28 [1] CRAN (R 4.1.1)
#>  digest          0.6.29     2021-12-01 [1] CRAN (R 4.1.2)
#>  dplyr           1.0.8      2022-02-08 [1] CRAN (R 4.1.2)
#>  ellipsis        0.3.2      2021-04-29 [1] CRAN (R 4.1.1)
#>  evaluate        0.14       2019-05-28 [1] CRAN (R 4.1.1)
#>  fansi           1.0.2      2022-01-14 [1] CRAN (R 4.1.2)
#>  fastmap         1.1.0      2021-01-25 [1] CRAN (R 4.1.1)
#>  forcats         0.5.1      2021-01-27 [1] CRAN (R 4.1.1)
#>  fs              1.5.2      2021-12-08 [1] CRAN (R 4.1.2)
#>  generics        0.1.2      2022-01-31 [1] CRAN (R 4.1.2)
#>  ggplot2         3.3.5      2021-06-25 [1] CRAN (R 4.1.1)
#>  glue            1.6.1      2022-01-22 [1] CRAN (R 4.1.2)
#>  gt              0.3.1      2021-08-07 [1] CRAN (R 4.1.1)
#>  gtable          0.3.0      2019-03-25 [1] CRAN (R 4.1.1)
#>  gtsummary     * 1.5.2.9002 2022-02-08 [1] Github (ddsjoberg/gtsummary@753b552)
#>  haven           2.4.3      2021-08-04 [1] CRAN (R 4.1.1)
#>  highr           0.9        2021-04-16 [1] CRAN (R 4.1.1)
#>  hms             1.1.1      2021-09-26 [1] CRAN (R 4.1.1)
#>  htmltools       0.5.2      2021-08-25 [1] CRAN (R 4.1.1)
#>  knitr           1.37       2021-12-16 [1] CRAN (R 4.1.2)
#>  labelled        2.9.0      2021-10-29 [1] CRAN (R 4.1.1)
#>  lifecycle       1.0.1      2021-09-24 [1] CRAN (R 4.1.1)
#>  magrittr        2.0.2      2022-01-26 [1] CRAN (R 4.1.2)
#>  memoise         2.0.1      2021-11-26 [1] CRAN (R 4.1.2)
#>  munsell         0.5.0      2018-06-12 [1] CRAN (R 4.1.1)
#>  parsedate       1.2.1      2021-04-20 [1] CRAN (R 4.1.1)
#>  pillar          1.7.0      2022-02-01 [1] CRAN (R 4.1.2)
#>  pkgbuild        1.3.1      2021-12-20 [1] CRAN (R 4.1.2)
#>  pkgconfig       2.0.3      2019-09-22 [1] CRAN (R 4.1.1)
#>  prettyunits     1.1.1      2020-01-24 [1] CRAN (R 4.1.1)
#>  processx        3.5.2      2021-04-30 [1] CRAN (R 4.1.1)
#>  ps              1.6.0      2021-02-28 [1] CRAN (R 4.1.1)
#>  purrr           0.3.4      2020-04-17 [1] CRAN (R 4.1.1)
#>  R.cache         0.15.0     2021-04-30 [1] CRAN (R 4.1.1)
#>  R.methodsS3     1.8.1      2020-08-26 [1] CRAN (R 4.1.1)
#>  R.oo            1.24.0     2020-08-26 [1] CRAN (R 4.1.1)
#>  R.utils         2.11.0     2021-09-26 [1] CRAN (R 4.1.1)
#>  R6              2.5.1      2021-08-19 [1] CRAN (R 4.1.1)
#>  rappdirs        0.3.3      2021-01-31 [1] CRAN (R 4.1.1)
#>  Rcpp            1.0.8      2022-01-13 [1] CRAN (R 4.1.2)
#>  rematch2        2.1.2      2020-05-01 [1] CRAN (R 4.1.1)
#>  remotes         2.4.2      2021-11-30 [1] CRAN (R 4.1.2)
#>  reprex          2.0.1      2021-08-05 [1] CRAN (R 4.1.1)
#>  rlang           1.0.1      2022-02-03 [1] CRAN (R 4.1.2)
#>  rmarkdown       2.11       2021-09-14 [1] CRAN (R 4.1.1)
#>  rprojroot       2.0.2      2020-11-15 [1] CRAN (R 4.1.1)
#>  RSQLite         2.2.9      2021-12-06 [1] CRAN (R 4.1.2)
#>  rstudioapi      0.13       2020-11-12 [1] CRAN (R 4.1.1)
#>  scales          1.1.1      2020-05-11 [1] CRAN (R 4.1.1)
#>  sessioninfo     1.2.2      2021-12-06 [1] CRAN (R 4.1.2)
#>  stringi         1.7.6      2021-11-29 [1] CRAN (R 4.1.2)
#>  stringr         1.4.0      2019-02-10 [1] CRAN (R 4.1.1)
#>  styler          1.6.2      2021-09-23 [1] CRAN (R 4.1.2)
#>  tibble          3.1.6      2021-11-07 [1] CRAN (R 4.1.1)
#>  tidyr           1.2.0      2022-02-01 [1] CRAN (R 4.1.2)
#>  tidyselect      1.1.1      2021-04-30 [1] CRAN (R 4.1.1)
#>  utf8            1.2.2      2021-07-24 [1] CRAN (R 4.1.1)
#>  vctrs           0.3.8      2021-04-29 [1] CRAN (R 4.1.1)
#>  withr           2.4.3      2021-11-30 [1] CRAN (R 4.1.2)
#>  xfun            0.29       2021-12-14 [1] CRAN (R 4.1.2)
#>  yaml            2.2.2      2022-01-25 [1] CRAN (R 4.1.2)
#> 
#>  [1] /home/emrys/R/x86_64-pc-linux-gnu-library/4.1
#>  [2] /usr/local/lib/R/site-library
#>  [3] /usr/lib/R/site-library
#>  [4] /usr/lib/R/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────

@ddsjoberg
Copy link
Owner

ddsjoberg commented Feb 8, 2022

Still confused about this one!

The mutate statement below is the one that is erring. Does this code work on your machine?

library(gtsummary)

table_body <-
  structure(
    list(
      variable = "cyl", var_label = c(cyl = "cyl"), 
      var_type = "continuous", reference_row = NA, row_type = "label", 
      header_row = NA, N_obs = 32L, N = 32L, coefficients_type = "generic", 
      coefficients_label = "Beta", label = c(cyl = "cyl"), term = "cyl", 
      var_class = c(cyl = "numeric"), var_nlevels = NA_integer_, 
      contrasts = NA_character_, contrasts_type = NA_character_, 
      n_obs = c(cyl = 32), estimate = -2.87579013906447, std.error = 0.322408882659104, 
      statistic = -8.91969884745751, p.value = 6.11268714258098e-10, 
      conf.low = -3.53423691978602, conf.high = -2.21734335834293), 
    row.names = c(NA, -1L), 
    class = c("broom.helpers", "tbl_df", "tbl", "data.frame"), 
    exponentiate = FALSE, 
    N_obs = 32L, 
    coefficients_type = "generic", 
    coefficients_label = "Beta"
  )

ci.sep <- " to "

table_body %>%
  dplyr::mutate( # adding character CI
    ci = dplyr::if_else(
      !is.na(.data$conf.low),
      paste0(gtsummary::style_sigfig(.data$conf.low), ci.sep, gtsummary::style_sigfig(.data$conf.high)),
      NA_character_
    )
  ) %>%
  dplyr::relocate(any_of("ci"), .after = "conf.high")

please try with and without setting the lancet theme

@gorkang
Copy link
Contributor Author

gorkang commented Feb 8, 2022

Indeed, it fails after setting the lancet theme!

# remotes::install_github("ddsjoberg/gtsummary@gorkang")

library(gtsummary)
packageVersion("gtsummary")
#> [1] '1.5.2.9002'


# WITHOUT lancet ----------------------------------------------------------

table_body <-
  structure(
    list(
      variable = "cyl", var_label = c(cyl = "cyl"), 
      var_type = "continuous", reference_row = NA, row_type = "label", 
      header_row = NA, N_obs = 32L, N = 32L, coefficients_type = "generic", 
      coefficients_label = "Beta", label = c(cyl = "cyl"), term = "cyl", 
      var_class = c(cyl = "numeric"), var_nlevels = NA_integer_, 
      contrasts = NA_character_, contrasts_type = NA_character_, 
      n_obs = c(cyl = 32), estimate = -2.87579013906447, std.error = 0.322408882659104, 
      statistic = -8.91969884745751, p.value = 6.11268714258098e-10, 
      conf.low = -3.53423691978602, conf.high = -2.21734335834293), 
    row.names = c(NA, -1L), 
    class = c("broom.helpers", "tbl_df", "tbl", "data.frame"), 
    exponentiate = FALSE, 
    N_obs = 32L, 
    coefficients_type = "generic", 
    coefficients_label = "Beta"
  )

ci.sep <- " to "

table_body %>%
  dplyr::mutate( # adding character CI
    ci = dplyr::if_else(
      !is.na(.data$conf.low),
      paste0(gtsummary::style_sigfig(.data$conf.low), ci.sep, gtsummary::style_sigfig(.data$conf.high)),
      NA_character_
    )
  ) %>%
  dplyr::relocate(any_of("ci"), .after = "conf.high")
#> # A tibble: 1 × 24
#>   variable var_label var_type   reference_row row_type header_row N_obs     N
#>   <chr>    <chr>     <chr>      <lgl>         <chr>    <lgl>      <int> <int>
#> 1 cyl      cyl       continuous NA            label    NA            32    32
#> # … with 16 more variables: coefficients_type <chr>, coefficients_label <chr>,
#> #   label <chr>, term <chr>, var_class <chr>, var_nlevels <int>,
#> #   contrasts <chr>, contrasts_type <chr>, n_obs <dbl>, estimate <dbl>,
#> #   std.error <dbl>, statistic <dbl>, p.value <dbl>, conf.low <dbl>,
#> #   conf.high <dbl>, ci <chr>



# WITH lancet -------------------------------------------------------------


theme_gtsummary_journal(journal = "lancet")
#> Setting theme `The Lancet`


table_body <-
  structure(
    list(
      variable = "cyl", var_label = c(cyl = "cyl"), 
      var_type = "continuous", reference_row = NA, row_type = "label", 
      header_row = NA, N_obs = 32L, N = 32L, coefficients_type = "generic", 
      coefficients_label = "Beta", label = c(cyl = "cyl"), term = "cyl", 
      var_class = c(cyl = "numeric"), var_nlevels = NA_integer_, 
      contrasts = NA_character_, contrasts_type = NA_character_, 
      n_obs = c(cyl = 32), estimate = -2.87579013906447, std.error = 0.322408882659104, 
      statistic = -8.91969884745751, p.value = 6.11268714258098e-10, 
      conf.low = -3.53423691978602, conf.high = -2.21734335834293), 
    row.names = c(NA, -1L), 
    class = c("broom.helpers", "tbl_df", "tbl", "data.frame"), 
    exponentiate = FALSE, 
    N_obs = 32L, 
    coefficients_type = "generic", 
    coefficients_label = "Beta"
  )

ci.sep <- " to "

table_body %>%
  dplyr::mutate( # adding character CI
    ci = dplyr::if_else(
      !is.na(.data$conf.low),
      paste0(gtsummary::style_sigfig(.data$conf.low), ci.sep, gtsummary::style_sigfig(.data$conf.high)),
      NA_character_
    )
  ) %>%
  dplyr::relocate(any_of("ci"), .after = "conf.high")
#> Error in `dplyr::mutate()`:
#> ! Problem while computing `ci = dplyr::if_else(...)`.
#> Caused by error in `nchar()`:
#> ! invalid multibyte string, element 1

Created on 2022-02-08 by the reprex package (v2.0.1)

Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.1.2 (2021-11-01)
#>  os       Ubuntu 20.04.3 LTS
#>  system   x86_64, linux-gnu
#>  ui       X11
#>  language (EN)
#>  collate  en_US.UTF-8
#>  ctype    en_US.UTF-8
#>  tz       Atlantic/Canary
#>  date     2022-02-08
#>  pandoc   2.14.0.3 @ /usr/lib/rstudio/bin/pandoc/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package       * version    date (UTC) lib source
#>  assertthat      0.2.1      2019-03-21 [1] CRAN (R 4.1.1)
#>  backports       1.4.1      2021-12-13 [1] CRAN (R 4.1.2)
#>  broom.helpers   1.6.0.9000 2022-02-08 [1] Github (larmarange/broom.helpers@81db4c5)
#>  cli             3.1.1      2022-01-20 [1] CRAN (R 4.1.2)
#>  colorspace      2.0-2      2021-06-24 [1] CRAN (R 4.1.1)
#>  crayon          1.4.2      2021-10-29 [1] CRAN (R 4.1.1)
#>  DBI             1.1.2      2021-12-20 [1] CRAN (R 4.1.2)
#>  digest          0.6.29     2021-12-01 [1] CRAN (R 4.1.2)
#>  dplyr           1.0.8      2022-02-08 [1] CRAN (R 4.1.2)
#>  ellipsis        0.3.2      2021-04-29 [1] CRAN (R 4.1.1)
#>  evaluate        0.14       2019-05-28 [1] CRAN (R 4.1.1)
#>  fansi           1.0.2      2022-01-14 [1] CRAN (R 4.1.2)
#>  fastmap         1.1.0      2021-01-25 [1] CRAN (R 4.1.1)
#>  fs              1.5.2      2021-12-08 [1] CRAN (R 4.1.2)
#>  generics        0.1.2      2022-01-31 [1] CRAN (R 4.1.2)
#>  ggplot2         3.3.5      2021-06-25 [1] CRAN (R 4.1.1)
#>  glue            1.6.1      2022-01-22 [1] CRAN (R 4.1.2)
#>  gt              0.3.1      2021-08-07 [1] CRAN (R 4.1.1)
#>  gtable          0.3.0      2019-03-25 [1] CRAN (R 4.1.1)
#>  gtsummary     * 1.5.2.9002 2022-02-08 [1] Github (ddsjoberg/gtsummary@753b552)
#>  highr           0.9        2021-04-16 [1] CRAN (R 4.1.1)
#>  htmltools       0.5.2      2021-08-25 [1] CRAN (R 4.1.1)
#>  knitr           1.37       2021-12-16 [1] CRAN (R 4.1.2)
#>  lifecycle       1.0.1      2021-09-24 [1] CRAN (R 4.1.1)
#>  magrittr        2.0.2      2022-01-26 [1] CRAN (R 4.1.2)
#>  munsell         0.5.0      2018-06-12 [1] CRAN (R 4.1.1)
#>  pillar          1.7.0      2022-02-01 [1] CRAN (R 4.1.2)
#>  pkgconfig       2.0.3      2019-09-22 [1] CRAN (R 4.1.1)
#>  purrr           0.3.4      2020-04-17 [1] CRAN (R 4.1.1)
#>  R.cache         0.15.0     2021-04-30 [1] CRAN (R 4.1.1)
#>  R.methodsS3     1.8.1      2020-08-26 [1] CRAN (R 4.1.1)
#>  R.oo            1.24.0     2020-08-26 [1] CRAN (R 4.1.1)
#>  R.utils         2.11.0     2021-09-26 [1] CRAN (R 4.1.1)
#>  R6              2.5.1      2021-08-19 [1] CRAN (R 4.1.1)
#>  reprex          2.0.1      2021-08-05 [1] CRAN (R 4.1.1)
#>  rlang           1.0.1      2022-02-03 [1] CRAN (R 4.1.2)
#>  rmarkdown       2.11       2021-09-14 [1] CRAN (R 4.1.1)
#>  rstudioapi      0.13       2020-11-12 [1] CRAN (R 4.1.1)
#>  scales          1.1.1      2020-05-11 [1] CRAN (R 4.1.1)
#>  sessioninfo     1.2.2      2021-12-06 [1] CRAN (R 4.1.2)
#>  stringi         1.7.6      2021-11-29 [1] CRAN (R 4.1.2)
#>  stringr         1.4.0      2019-02-10 [1] CRAN (R 4.1.1)
#>  styler          1.6.2      2021-09-23 [1] CRAN (R 4.1.2)
#>  tibble          3.1.6      2021-11-07 [1] CRAN (R 4.1.1)
#>  tidyr           1.2.0      2022-02-01 [1] CRAN (R 4.1.2)
#>  tidyselect      1.1.1      2021-04-30 [1] CRAN (R 4.1.1)
#>  utf8            1.2.2      2021-07-24 [1] CRAN (R 4.1.1)
#>  vctrs           0.3.8      2021-04-29 [1] CRAN (R 4.1.1)
#>  withr           2.4.3      2021-11-30 [1] CRAN (R 4.1.2)
#>  xfun            0.29       2021-12-14 [1] CRAN (R 4.1.2)
#>  yaml            2.2.2      2022-01-25 [1] CRAN (R 4.1.2)
#> 
#>  [1] /home/emrys/R/x86_64-pc-linux-gnu-library/4.1
#>  [2] /usr/local/lib/R/site-library
#>  [3] /usr/lib/R/site-library
#>  [4] /usr/lib/R/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────

@ddsjoberg
Copy link
Owner

Thank you SOOO much for going through this with me.

I think it may be an encoding issue the in the mid-point used for decimal places. Maybe I need to update it to something more OS-agnostic?

Let's try this.....

library(gtsummary)

x <- c(0.234, 123.3, 5)

# just the default
style_sigfig(x)
#> [1] "0.23" "123"  "5.0"
# using the midpoint
style_sigfig(x, decimal.mark = "·")
#> [1] "0·23" "123"  "5·0"
# using the midpoint saved in gtsummary
style_sigfig(x, decimal.mark = gtsummary:::special_char$interpunct)
#> [1] "0·23" "123"  "5·0"

# setting Lancet theme
theme_gtsummary_journal("lancet")
#> Setting theme `The Lancet`
style_sigfig(x)
#> [1] "0·23" "123"  "5·0"

Created on 2022-02-08 by the reprex package (v2.0.1)

@gorkang
Copy link
Contributor Author

gorkang commented Feb 8, 2022

Thanks to you for taking a look into this! Here are the results.

I think I found the issue, see in the next chunk.

library(gtsummary)

x <- c(0.234, 123.3, 5)

# just the default
style_sigfig(x)
#> [1] "0.23" "123"  "5.0"

# using the midpoint
style_sigfig(x, decimal.mark = "·")
#> [1] "0·23" "123"  "5·0"

# using the midpoint saved in gtsummary
style_sigfig(x, decimal.mark = gtsummary:::special_char$interpunct)
#> Error in nchar(x, "c"): invalid multibyte string, element 1

# setting Lancet theme
theme_gtsummary_journal("lancet")
#> Setting theme `The Lancet`

style_sigfig(x)
#> Error in nchar(x, "c"): invalid multibyte string, element 1

Created on 2022-02-08 by the reprex package (v2.0.1)'

I copied the contents of the style_sigfig() and style_number() functions to see where exactly the problem was arising.

The culprit is decimal.mark = gtsummary:::special_char$interpunct. The good news, using decimal.mark = "\U00B7" seems to work?

library(tidyverse)


# style_sigfig(x, decimal.mark = gtsummary:::special_char$interpunct)

x = 4 
digits = 2
scale = 1
big.mark = NULL
decimal.mark = gtsummary:::special_char$interpunct

d <- paste0("round(abs(x * scale), digits = ", digits - 
              digits:1 + 1, ") < 10^", digits - digits:1, " ~ ", digits:1, 
            collapse = ", ") %>% {
              paste0("case_when(", ., ", TRUE ~ 0)")
            } %>% parse(text = .) %>% eval()


# style_number(x, digits = d, scale = scale, big.mark = big.mark, 
#              decimal.mark = decimal.mark)

digits = d

decimal.mark <- decimal.mark %||% gtsummary:::get_theme_element("style_number-arg:decimal.mark", 
                                                                default = getOption("OutDec", default = "."))
big.mark <- big.mark %||% gtsummary:::get_theme_element("style_number-arg:big.mark", 
                                                        default = ifelse(identical(decimal.mark, ","), "", 
                                                                         ","))
digits <- rep(digits, length.out = length(x))

ret <- map2_chr(x, digits, function(.x, .y) {
  round(.x * scale, digits = .y) %>% format(big.mark = big.mark, 
                                            decimal.mark = decimal.mark, nsmall = .y, scientific = FALSE, 
                                            trim = TRUE)
})
#> Error in nchar(x, "c"): invalid multibyte string, element 1
ret[is.na(x)] <- NA_character_
#> Error in ret[is.na(x)] <- NA_character_: object 'ret' not found
names(ret) <- names(x)
#> Error in names(ret) <- names(x): object 'ret' not found
ret
#> Error in eval(expr, envir, enclos): object 'ret' not found


# Issue here
.x = 4
.y = 1
round(.x * scale, digits = .y) %>% format(big.mark = big.mark, 
                                          decimal.mark = decimal.mark, nsmall = .y, scientific = FALSE, 
                                          trim = TRUE)
#> Error in nchar(x, "c"): invalid multibyte string, element 1

# A normal . works
decimal.mark = "."
round(.x * scale, digits = .y) %>% format(big.mark = big.mark, 
                                          decimal.mark = decimal.mark, nsmall = .y, scientific = FALSE, 
                                          trim = TRUE)
#> [1] "4.0"

# The interpunct does not
decimal.mark = gtsummary:::special_char$interpunct

round(.x * scale, digits = .y) %>% format(big.mark = big.mark, 
                                          decimal.mark = decimal.mark, nsmall = .y, scientific = FALSE, 
                                          trim = TRUE)
#> Error in nchar(x, "c"): invalid multibyte string, element 1

# Using Unicode works
decimal.mark = "\U00B7"
round(.x * scale, digits = .y) %>% format(big.mark = big.mark, 
                                          decimal.mark = decimal.mark, nsmall = .y, scientific = FALSE, 
                                          trim = TRUE)
#> [1] "4·0"

Created on 2022-02-08 by the reprex package (v2.0.1)

@ddsjoberg
Copy link
Owner

Hmmm, using that UTF code, the table renders like this on my machine

image

I wonder how to best make this work 🤔 Maybe something like looking at the user's OS and inserting the UTF code or the interpunct we already have? I am not sure, but I sure do hate encoding issues! 😄

@gorkang
Copy link
Contributor Author

gorkang commented Feb 9, 2022

Yes, encoding issues are horrible... :(

It seems U00B7 is really the right Unicode... although there are other alternatives... See https://www.google.com/inputtools/try/, or https://japanese.meta.stackexchange.com/questions/656/how-do-i-type-the-interpunct/659#659

In the past, I had some encoding issues in R projects when switching between OSes, and ended up solving them including options(encoding = "UTF-8") in the .Rprofile.R file. Not sure how it works for packages though.

Let me know if I can help testing anything.

@RaviBot
Copy link

RaviBot commented Feb 10, 2022

Hi! First off thank you for the amazing package! I just wanted to let you know I am having the same issue with the Lancet option.

@ddsjoberg
Copy link
Owner

@RaviBot what OS are you on?

@ddsjoberg
Copy link
Owner

hey hey @gorkang, I don't have time work on the encoding issues now, unfortunately. Do you want to work on it? If not, I can try to reach out to find someone who can.

@RaviBot
Copy link

RaviBot commented Feb 10, 2022

@RaviBot what OS are you on?

I am on macOS Monterey 12.1

@ddsjoberg
Copy link
Owner

thanks @RaviBot ! Does @gorkang 's solution of using "\U00B7" work on macOS?

@RaviBot
Copy link

RaviBot commented Feb 11, 2022

When doing the following,
x <- c(0.234, 123.3, 5) style_sigfig(x, decimal.mark = "\U00B7")
It works, and will produce this output:
[1] "0·23" "123" "5·0"

However, I don't know where I should put the
decimal.mark = "\U00B7"
in order to have it actually take effect after setting the Lancet theme.

This is what I have right now:

my_ES_test <- function(data, variable, by, ...) {
  rstatix::cohens_d(data, as.formula(glue::glue("{variable} ~ {by}")))$effsize
}
my_cramer_v <- function(data, variable, by, ...) {
  table(data[[variable]], data[[by]]) %>%
    rstatix::cramer_v()
}

theme_gtsummary_journal(journal = "lancet")
theme_gtsummary_compact()

struc_data_matched %>%
  dplyr::select(Pain, Age, Sex, SES, eTIV, Anxiety, Depression) %>%
  tbl_summary(by = Pain) %>%
  add_n() %>%
  add_p() %>%
  bold_labels() %>%
  add_stat(fns = all_continuous() ~ my_ES_test) %>%
  add_stat(fns = all_categorical() ~ my_cramer_v) %>%
  modify_header(add_stat_1 ~ "**Cohen's D**") %>%
  modify_header(add_stat_2 ~ "**Cramer's V**")

Where do I change the decimal.mark to "\U00B7" in order to have it take effect?
Thanks for your help!

gorkang added a commit to gorkang/gtsummary that referenced this issue Feb 11, 2022
@gorkang
Copy link
Contributor Author

gorkang commented Feb 11, 2022

@ddsjoberg , I forked the repo and changed the following in theme_gtsummary():

"style_number-arg:decimal.mark" = special_char$interpunct, -> "style_number-arg:decimal.mark" = "·",

I am not sure why, but it works on my Ubuntu computer and on a MacOS Catalina VM (was giving an error before this change). It also works on a Windows 10 VM (was working before the change)

@RaviBot , could you try if it works in your system? You can run the lines below:

remotes::install_github("gorkang/gtsummary")

# Restart R session
rstudioapi::restartSession()

library(gtsummary)
model = lm(mpg ~ wt, mtcars)
gtsummary::tbl_regression(model)
theme_gtsummary_journal(journal = "lancet")
gtsummary::tbl_regression(model)

@ddsjoberg
Copy link
Owner

@gorkang ! this works on my machine too!

I am just guessing here, but the interpunct was previously created on my local windows machine and added to the pkg as data. Perhaps the issue is that the interpunct was rendered adn saved on the Windows machine. In your example, the interpunct is in a function, so it's not being rendered (idk what that even means in this situation) until the function is run, and therefore it's accessed on the local OS without encoding conflicts.

Let's wait for confirmation from @RaviBot on their machine, and if it works, can you submit a pull request with the fix?

@RaviBot
Copy link

RaviBot commented Feb 11, 2022

@ddsjoberg , I forked the repo and changed the following in theme_gtsummary():

"style_number-arg:decimal.mark" = special_char$interpunct, -> "style_number-arg:decimal.mark" = "·",

I am not sure why, but it works on my Ubuntu computer and on a MacOS Catalina VM (was giving an error before this change). It also works on a Windows 10 VM (was working before the change)

@RaviBot , could you try if it works in your system? You can run the lines below:

remotes::install_github("gorkang/gtsummary")

# Restart R session
rstudioapi::restartSession()

library(gtsummary)
model = lm(mpg ~ wt, mtcars)
gtsummary::tbl_regression(model)
theme_gtsummary_journal(journal = "lancet")
gtsummary::tbl_regression(model)

I ran the code and got the following two tables:
image

image

I then tried my own tables and the decimal was also appearing as a raised dot instead of a decimal.

@gorkang
Copy link
Contributor Author

gorkang commented Feb 12, 2022

Thanks @RaviBot for checking. AFAIK, those are the expected outputs.

@ddsjoberg , when running rcmdcheck::rcmdcheck() there is a warning because, of course, "·" is not an ASCII character. And using theASCII code, intToUtf8(0x00b7), causes the issue you had, but only on Windows... So, you solution of detecting the os and adapting the output sounds as good as any at his point :)

I used it in the past with something like this... would you want a pull request with this "solution"?

OS = Sys.info()["sysname"]

if (OS == "Windows") {
interpunct_char = special_char$interpunct
} else {
interpunct_char = "\U00B7"
}
...
"style_number-arg:decimal.mark" = interpunct_char

@ddsjoberg
Copy link
Owner

Thank you @gorkang and @RaviBot ! This is super helpful!

I'll try to make this update soon! Appreciate you looking into this.

@ddsjoberg ddsjoberg added this to the v1.5.3 milestone Feb 16, 2022
@ddsjoberg ddsjoberg mentioned this issue Feb 17, 2022
15 tasks
@ddsjoberg
Copy link
Owner

Hey hey @gorkang and @RaviBot , can you check out this branch and let me know if the Lancet midpoint is working on your machines?

devtools::install_github("ddsjoberg/gtsummary@midpoint_encoding")

library(gtsummary)
theme_gtsummary_journal("lancet")

trial |> 
  tbl_summary(include = marker)

image

@gorkang
Copy link
Contributor Author

gorkang commented Feb 17, 2022

It does not work, but after looking at the changes in this version, it seems there might a good reason.

The patch has been applied to else if (journal == "nejm") { but not to else if (journal == "lancet") { ? :)

# devtools::install_github("ddsjoberg/gtsummary@midpoint_encoding")

library(gtsummary)
packageVersion("gtsummary")
#> [1] '1.5.2.9002'
theme_gtsummary_journal("lancet")
#> Setting theme `The Lancet`

trial |> 
  tbl_summary(include = marker)
#> Error in `mutate()`:
#> ! Problem while computing `tbl_stats = pmap(...)`.
#> Caused by error in `nchar()`:
#> ! invalid multibyte string, element 1

Created on 2022-02-17 by the reprex package (v2.0.1)

Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.1.2 (2021-11-01)
#>  os       Ubuntu 20.04.3 LTS
#>  system   x86_64, linux-gnu
#>  ui       X11
#>  language (EN)
#>  collate  en_US.UTF-8
#>  ctype    en_US.UTF-8
#>  tz       Atlantic/Canary
#>  date     2022-02-17
#>  pandoc   2.17.0.1 @ /usr/lib/rstudio/bin/quarto/bin/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package       * version    date (UTC) lib source
#>  assertthat      0.2.1      2019-03-21 [1] CRAN (R 4.1.0)
#>  backports       1.4.1      2021-12-13 [1] CRAN (R 4.1.2)
#>  broom.helpers   1.6.0      2022-01-12 [1] CRAN (R 4.1.2)
#>  cli             3.2.0      2022-02-14 [1] CRAN (R 4.1.2)
#>  colorspace      2.0-2      2021-06-24 [1] CRAN (R 4.1.0)
#>  crayon          1.5.0      2022-02-14 [1] CRAN (R 4.1.2)
#>  DBI             1.1.2      2021-12-20 [1] CRAN (R 4.1.2)
#>  digest          0.6.29     2021-12-01 [1] CRAN (R 4.1.2)
#>  dplyr           1.0.8      2022-02-08 [1] CRAN (R 4.1.2)
#>  ellipsis        0.3.2      2021-04-29 [1] CRAN (R 4.1.0)
#>  evaluate        0.14       2019-05-28 [1] CRAN (R 4.1.0)
#>  fansi           1.0.2      2022-01-14 [1] CRAN (R 4.1.2)
#>  fastmap         1.1.0      2021-01-25 [1] CRAN (R 4.1.0)
#>  forcats         0.5.1      2021-01-27 [1] CRAN (R 4.1.0)
#>  fs              1.5.2      2021-12-08 [1] CRAN (R 4.1.2)
#>  generics        0.1.2      2022-01-31 [1] CRAN (R 4.1.2)
#>  ggplot2         3.3.5      2021-06-25 [1] CRAN (R 4.1.0)
#>  glue            1.6.1      2022-01-22 [1] CRAN (R 4.1.2)
#>  gt              0.4.0      2022-02-15 [1] CRAN (R 4.1.2)
#>  gtable          0.3.0      2019-03-25 [1] CRAN (R 4.1.0)
#>  gtsummary     * 1.5.2.9002 2022-02-17 [1] Github (ddsjoberg/gtsummary@24d0394)
#>  highr           0.9        2021-04-16 [1] CRAN (R 4.1.0)
#>  htmltools       0.5.2      2021-08-25 [1] CRAN (R 4.1.1)
#>  knitr           1.37       2021-12-16 [1] CRAN (R 4.1.2)
#>  lifecycle       1.0.1      2021-09-24 [1] CRAN (R 4.1.1)
#>  magrittr        2.0.2      2022-01-26 [1] CRAN (R 4.1.2)
#>  munsell         0.5.0      2018-06-12 [1] CRAN (R 4.1.0)
#>  pillar          1.7.0      2022-02-01 [1] CRAN (R 4.1.2)
#>  pkgconfig       2.0.3      2019-09-22 [1] CRAN (R 4.1.0)
#>  purrr           0.3.4      2020-04-17 [1] CRAN (R 4.1.0)
#>  R.cache         0.15.0     2021-04-30 [1] CRAN (R 4.1.0)
#>  R.methodsS3     1.8.1      2020-08-26 [1] CRAN (R 4.1.0)
#>  R.oo            1.24.0     2020-08-26 [1] CRAN (R 4.1.0)
#>  R.utils         2.11.0     2021-09-26 [1] CRAN (R 4.1.1)
#>  R6              2.5.1      2021-08-19 [1] CRAN (R 4.1.1)
#>  reprex          2.0.1      2021-08-05 [1] CRAN (R 4.1.0)
#>  rlang           1.0.1      2022-02-03 [1] CRAN (R 4.1.2)
#>  rmarkdown       2.11       2021-09-14 [1] CRAN (R 4.1.1)
#>  rstudioapi      0.13       2020-11-12 [1] CRAN (R 4.1.0)
#>  scales          1.1.1      2020-05-11 [1] CRAN (R 4.1.0)
#>  sessioninfo     1.2.2      2021-12-06 [1] CRAN (R 4.1.2)
#>  stringi         1.7.6      2021-11-29 [1] CRAN (R 4.1.2)
#>  stringr         1.4.0      2019-02-10 [1] CRAN (R 4.1.0)
#>  styler          1.6.2      2021-09-23 [1] CRAN (R 4.1.1)
#>  tibble          3.1.6      2021-11-07 [1] CRAN (R 4.1.2)
#>  tidyr           1.2.0      2022-02-01 [1] CRAN (R 4.1.2)
#>  tidyselect      1.1.1      2021-04-30 [1] CRAN (R 4.1.0)
#>  utf8            1.2.2      2021-07-24 [1] CRAN (R 4.1.0)
#>  vctrs           0.3.8      2021-04-29 [1] CRAN (R 4.1.0)
#>  withr           2.4.3      2021-11-30 [1] CRAN (R 4.1.2)
#>  xfun            0.29       2021-12-14 [1] CRAN (R 4.1.2)
#>  yaml            2.2.2      2022-01-25 [1] CRAN (R 4.1.2)
#> 
#>  [1] /home/emrys/R/x86_64-pc-linux-gnu-library/4.1
#>  [2] /usr/local/lib/R/site-library
#>  [3] /usr/lib/R/site-library
#>  [4] /usr/lib/R/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────

@ddsjoberg
Copy link
Owner

Aiya! Sorry, but I had accidentally updated the NEJM theme instead of the Lancet. Can you try again @gorkang ?

@gorkang
Copy link
Contributor Author

gorkang commented Feb 17, 2022

No worries :-)

Works great now!

@ddsjoberg
Copy link
Owner

OMG YESSS! Thank you!

@RaviBot can you check on Mac OS?

@gorkang
Copy link
Contributor Author

gorkang commented Feb 17, 2022

In my MacOS Catalina VM works fine too.

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

Successfully merging a pull request may close this issue.

3 participants