davidgohel / flextable

table farming
https://ardata-fr.github.io/flextable-book/
561 stars 81 forks source link

flextable requires R >= 4.1.0 #655

Closed trekonom closed 2 months ago

trekonom commented 2 months ago

As documented in this SO post flextable 0.9.6 might break with an error on R < 4.1.0. The reason is most likely that in some places apply is called with simplify=FALSE, e.g.

https://github.com/davidgohel/flextable/blob/b03d310d1d16db1635520ad55bc90879ab734f85/R/compose.R#L202

which was introduced in R 4.1.0 (see the New Features section on R 4.1.0 here).

I was able to reproduce the issue using flextable 0.9.6 and the rocker:tidyverse:4.0.3 docker image:

library(flextable)
#> Warning: package 'flextable' was built under R version 4.0.5
z <- summarizor(
  x = CO2[-c(1, 4)],
  by = "Treatment",
  overall_label = "Overall"
)

ft_1 <- as_flextable(z, separate_with = "variable")
#> Error in FUN(newX[, i], ...): unused argument (simplify = FALSE)

ft_1
#> Error in eval(expr, envir, enclos): object 'ft_1' not found

Created on 2024-08-27 by the reprex package (v1.0.0)

Session info ``` r sessioninfo::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.0.3 (2020-10-10) #> os Ubuntu 20.04.5 LTS #> system x86_64, linux-gnu #> ui X11 #> language (EN) #> collate en_US.UTF-8 #> ctype en_US.UTF-8 #> tz Etc/UTC #> date 2024-08-27 #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date lib source #> askpass 1.1 2019-01-13 [1] RSPM (R 4.0.3) #> assertthat 0.2.1 2019-03-21 [1] RSPM (R 4.0.5) #> cli 2.3.0 2021-01-31 [1] RSPM (R 4.0.3) #> crayon 1.4.1 2021-02-08 [1] RSPM (R 4.0.3) #> crul 1.5.0 2024-07-19 [1] RSPM (R 4.0.5) #> curl 4.3 2019-12-02 [1] RSPM (R 4.0.3) #> data.table 1.13.6 2020-12-30 [1] RSPM (R 4.0.3) #> digest 0.6.27 2020-10-24 [1] RSPM (R 4.0.3) #> evaluate 0.14 2019-05-28 [1] RSPM (R 4.0.3) #> fastmap 1.2.0 2024-05-15 [1] RSPM (R 4.0.5) #> flextable * 0.9.6 2024-05-05 [1] RSPM (R 4.0.5) #> fontBitstreamVera 0.1.1 2017-02-01 [1] RSPM (R 4.0.5) #> fontLiberation 0.1.0 2016-10-15 [1] RSPM (R 4.0.5) #> fontquiver 0.2.1 2017-02-01 [1] RSPM (R 4.0.5) #> fs 1.5.0 2020-07-31 [1] RSPM (R 4.0.3) #> gdtools 0.3.7 2024-03-05 [1] RSPM (R 4.0.5) #> gfonts 0.2.0 2023-01-08 [1] RSPM (R 4.0.5) #> glue 1.4.2 2020-08-27 [1] RSPM (R 4.0.5) #> highr 0.8 2019-03-20 [1] RSPM (R 4.0.3) #> htmltools 0.5.8.1 2024-04-04 [1] RSPM (R 4.0.5) #> httpcode 0.3.0 2020-04-10 [1] RSPM (R 4.0.5) #> httpuv 1.6.15 2024-03-26 [1] RSPM (R 4.0.5) #> jsonlite 1.7.2 2020-12-09 [1] RSPM (R 4.0.3) #> knitr 1.31 2021-01-27 [1] RSPM (R 4.0.3) #> later 1.1.0.1 2020-06-05 [1] RSPM (R 4.0.3) #> lifecycle 0.2.0 2020-03-06 [1] RSPM (R 4.0.3) #> magrittr 2.0.1 2020-11-17 [1] RSPM (R 4.0.5) #> mime 0.9 2020-02-04 [1] RSPM (R 4.0.3) #> officer 0.6.6 2024-05-05 [1] RSPM (R 4.0.5) #> openssl 1.4.3 2020-09-18 [1] RSPM (R 4.0.3) #> promises 1.1.1 2020-06-09 [1] RSPM (R 4.0.3) #> R6 2.5.0 2020-10-28 [1] RSPM (R 4.0.3) #> ragg 1.3.2 2024-05-15 [1] RSPM (R 4.0.5) #> Rcpp 1.0.13 2024-07-17 [1] RSPM (R 4.0.5) #> reprex 1.0.0 2021-01-27 [1] RSPM (R 4.0.3) #> rlang 1.1.4 2024-06-04 [1] RSPM (R 4.0.5) #> rmarkdown 2.6 2020-12-14 [1] RSPM (R 4.0.3) #> rstudioapi 0.13 2020-11-12 [1] RSPM (R 4.0.3) #> sessioninfo 1.1.1 2018-11-05 [1] RSPM (R 4.0.3) #> shiny 1.9.1 2024-08-01 [1] RSPM (R 4.0.5) #> stringi 1.5.3 2020-09-09 [1] RSPM (R 4.0.3) #> stringr 1.4.0 2019-02-10 [1] RSPM (R 4.0.3) #> systemfonts 1.1.0 2024-05-15 [1] RSPM (R 4.0.5) #> textshaping 0.4.0 2024-05-24 [1] RSPM (R 4.0.5) #> uuid 0.1-4 2020-02-26 [1] RSPM (R 4.0.3) #> withr 2.4.1 2021-01-26 [1] RSPM (R 4.0.3) #> xfun 0.21 2021-02-10 [1] RSPM (R 4.0.3) #> xml2 1.3.2 2020-04-23 [1] RSPM (R 4.0.3) #> xtable 1.8-4 2019-04-21 [1] RSPM (R 4.0.5) #> yaml 2.2.1 2020-02-01 [1] RSPM (R 4.0.3) #> zip 2.1.1 2020-08-27 [1] RSPM (R 4.0.3) #> #> [1] /usr/local/lib/R/site-library #> [2] /usr/local/lib/R/library ```
davidgohel commented 2 months ago

thanks @trekonom I will try to fix very soon

eli-daniels commented 2 months ago

The package passes all CMD tests by just removing the only two occurrences of simplify = FALSE in compose.R in the labelisor() function. But whether it is being tested already, I'm not sure.

davidgohel commented 2 months ago

it should be fixed now