Search code examples
rrlangreadxl

Error in readxl::read_excel: is_null(n) : object 'rlang_is_null' not found


When trying to run the sample code given here:

xlsx_example <- readxl_example("datasets.xlsx")
read_excel(xlsx_example)

I get the error Error in is_null(n) : object 'rlang_is_null' not found

Info about my R session:

sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

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

other attached packages:
[1] readxl_1.0.0

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.13     lattice_0.20-35  ape_5.0          tidyr_0.7.2      cellranger_1.1.0 grid_3.4.2       plyr_1.8.4      
 [8] jsonlite_1.5     nlme_3.1-131     gtable_0.2.0     magrittr_1.5     scales_0.5.0     ggplot2_2.2.1    rlang_0.1.2.9000
[15] lazyeval_0.2.1   ggtree_1.10.0    rvcheck_0.0.9    treeio_1.2.0     tools_3.4.2      glue_1.2.0       purrr_0.2.4     
[22] munsell_0.4.3    yaml_2.1.14      parallel_3.4.2   compiler_3.4.2   colorspace_1.3-2 tibble_1.3.4 

I presume the error points to rlang package though.

I also tried to install older versions of readxl package, but I got the same error.

install.packages("https://cran.r-project.org/src/contrib/Archive/readxl/readxl_0.1.1.tar.gz", 
                 repos=NULL, type="source")
# or
install.packages("https://cran.r-project.org/src/contrib/Archive/readxl/readxl_0.1.0.tar.gz", 
                 repos=NULL, type="source")

Solution

  • rlang_is_null is a compiled function within rlang. If "restarting R" (the analogy of the windows 3-finger salute) doesn't resolve things, it sounds like the package installation is bad.

    Try:

    1. moving it out of the way (eventually for deletion, but I don't like deleting if other aspects still work);

    2. re-install rlang, likely the binary of it (default);

    3. if that doesn't work, consider compiling the source (assuming Rtools is installed ... have not tried but should work fine); then

    4. Restart R. I usually don't trust detach or unload and a subsequent library to fix problems with packages with compiled objects (mostly under windows), so a clean restart is my suggestion.