brad-cannell / codebookr

Create Codebooks From Data Frames
https://brad-cannell.github.io/codebookr/
Other
25 stars 7 forks source link

Impossible to install in R 4.0 : code error in file cb_summary_stats_numeric.R #60

Open aeshjalmur opened 1 month ago

aeshjalmur commented 1 month ago

Attempting installation of codebooker in R 4.0 results in the following error which aborts installation:

cb_summary_stats_numeric.R:30:54: unexpected input 29: # Format output 30: dplyr::mutate(dplyr::across(dplyr::everything(), \ ^ ERROR: unable to collate and parse R files for package 'codebookr'

The affected lines of file cb_summary_stats_numeric.R are:

29 # Format output 30 dplyr::mutate(dplyr::across(dplyr::everything(), (x) round(x, digits = digits))) %>% 31 dplyr::mutate(dplyr::across(dplyr::everything(), (x) format(x, nsmall = digits)))

The dash syntax seems to be incompatible with R

Replacement by the following lines solved the installation issue, but I do not know yet if the package will remain functional after this substitution : 29 # Format output 30 dplyr::mutate(dplyr::across(dplyr::everything(), ~ round(.x, digits = digits))) %>% 31 dplyr::mutate(dplyr::across(dplyr::everything(), ~ format(.x, nsmall = digits)))

Best

mbcann01 commented 1 month ago

@aeshjalmur Thank you for letting me know. Do you mind telling me what version of R you are using?

aeshjalmur commented 1 month ago

I am using R version 4.0.0 (2020-04-24) -- "Arbor Day" Copyright (C) 2020 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit).

Additionnally, I tried the codebook function from the package, and it did not work for me as it displayed the following error which I could not solve: Erreur : 'reframe' is not an exported object from 'namespace:dplyr'

mbcann01 commented 1 month ago

Hi @aeshjalmur, That makes sense.

You should be able to fix these errors by updating base R and dplyr. However, you may have a good reason for not wanting to do so. On my end, I think I can, and should, update the dependency file to indicate that base R version 4.1 or greater and dplyr version 1.1 or greater are required by this package.