vincentarelbundock / tinytable

Simple and Customizable Tables in `R`
https://vincentarelbundock.github.io/tinytable
GNU General Public License v3.0
196 stars 16 forks source link

Possible issue with new R/Rstudio versions #237

Closed baarthur closed 5 months ago

baarthur commented 5 months ago

Hi Vincent,

I've just updated my R and Rstudio and now suddenly the width parameter isn't working anymore. Reprex comes from the tutorial vignette:

x <- mtcars[1:4, 1:5]
tt(x, width = c(.3, .1, .1, .1, .1))

Results in

Error: `width` must be numeric; its length must be 1

3.  stop(msg, call. = FALSE)
2.  assert_numeric(width, len = 1, lower = 0, upper = 1, null.ok = TRUE)
1.   tt(x, width = c(0.3, 0.1, 0.1, 0.1, 0.1))

Here's my sessionInfo():

R version 4.4.0 (2024-04-24)
Platform: aarch64-apple-darwin20
Running under: macOS Sonoma 14.1.1

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/Sao_Paulo
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] compiler_4.4.0    magrittr_2.0.3    cli_3.6.2         tools_4.4.0       glue_1.7.0       
 [6] rstudioapi_0.16.0 stringi_1.8.3     knitr_1.46        xfun_0.43         stringr_1.5.1    
[11] lifecycle_1.0.4   rlang_1.1.3      
vincentarelbundock commented 5 months ago

You are trying to use a development version feature.

baarthur commented 5 months ago

I don't understand... It was working minutes ago

vincentarelbundock commented 5 months ago

install from github, restart R and try again

baarthur commented 5 months ago

Ohh got it, my bad. I forgot I was using the developer version and reinstalled modelsummary from the CRAN after updating R.

btw, I don't want to start yet another thread but I am having trouble with line breaks in footnotes. I applied the same logic from the tt note argument:

set.seed(1)

df <- tibble(
  x_1 = rnorm(100, 10, 3),
  x_2 = rnorm(100, 7, 2.5),
  u = rnorm(100, 0, 0.02),
  y = 1 + 2*x_1 - 3*x_2 + u
)

lm <- list(
  lm_1 = lm(y ~ x_1, data = df),
  lm_2 = lm(y ~ x_1 + x_2, data = df)
)

modelsummary(lm, note = "{A \\\\ B}")

when the PDF renders, the footnote is ipsis litteris "{A \\ B}". I tried using escape = F but then it won't compile, as well as changing output between tinytable and latex. what am I doing wrong this time?