ggtree 2.4.2 error: Error in DataMask$new(.data, caller_env) : argument "caller_env" is missing, with no default - ggtree

I am trying to plot an ancestral states tree generated in RevBayes using RevGadgets 1.0.0 and ggtree 2.4.2. The call is the following, and all of the variables check out, including the tree file, in Nexus format, which I can open in FigTree etc.
pp=plot_ancestral_states(tree_file=tree_fn,
include_start_states=T,
summary_statistic="PieRange",
state_labels=state_labels,
state_colors=state_colors,
tip_label_size=2.5,
tip_label_offset=0.1,
node_label_size=0,
shoulder_label_size=0,
show_posterior_legend=T,
tip_pie_diameter=0.5,
node_pie_diameter=2.0,
pie_nudge_x=0.03,
pie_nudge_y=0.16,
alpha=1)
The error message is "Error in DataMask$new(.data, caller_env) : argument "caller_env" is missing, with no default"
This seems like an rlang error, but I'm not finding a way to troubleshoot it. There's zero documentation for the RevGadgets call "plot_ancestral_states."
Thanks for any assistance.

Turns out it's a problem with the latest version of dplyr. Removing dplyr 1.0.6 and installing 1.0.5 from the archive fixed the issue.

I've had the exact same problem, but rolling back to 1.0.4 version of Dplyr did not fix it. Also, I've seen it run on other machines that are using 1.0.6 (as am I) so I'm wondering if there's any other issue you're aware of?
Cheers
GMD
Here's my sessionInfo in case it helps.
R version 4.0.5 (2021-03-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
Matrix products: default
locale:
[1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252 LC_MONETARY=English_Australia.1252 LC_NUMERIC=C
[5] LC_TIME=English_Australia.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggtree_2.4.2
loaded via a namespace (and not attached):
[1] Rcpp_1.0.6 magrittr_2.0.1 tidyselect_1.1.1 aplot_0.0.6 munsell_0.5.0 colorspace_2.0-1 ape_5.5
[8] lattice_0.20-41 R6_2.5.0 rlang_0.4.11 fansi_0.4.2 dplyr_1.0.6 patchwork_1.1.1 tools_4.0.5
[15] parallel_4.0.5 grid_4.0.5 gtable_0.3.0 nlme_3.1-152 utf8_1.2.1 ellipsis_0.3.2 lazyeval_0.2.2
[22] tibble_3.1.1 lifecycle_1.0.0 crayon_1.4.1 treeio_1.14.4 tidyr_1.1.3 BiocManager_1.30.15 purrr_0.3.4
[29] ggplot2_3.3.3 vctrs_0.3.8 tidytree_0.3.3 glue_1.4.2 compiler_4.0.5 pillar_1.6.1 rvcheck_0.1.8
[36] generics_0.1.0 scales_1.1.1 jsonlite_1.7.2 pkgconfig_2.0.3

ISSUE RESOLVED
Solution as follows from the developer:
Please also update tidytree by remotes::install_github("YuLab-SMU/tidytree") . This is beacuse the mutate.tbl_tree in tidytree was not updated in old version.
I also rolled back dplyr from 1.0.6 to 1.0.5 as per his instructions. Not sure whether the tidytree change would have been suffcient,, and I'm not brave enough to try.

I had the same problem and tried first just updating tidytree and it didn't work. Also had to go back to dplyr 1.0.5.
Another option is to update ggtree from GitHub remotes::install_github("YuLab-SMU/ggtree"), which should work with dplyr 1.0.6

Building on Peter B's solution for those (like me) who haven't needed to install an archived version of a package before, this is what worked for me.
#Start a new R session
remove.packages("dplyr")
devtools::install_version("dplyr",version="1.0.5")
require(dplyr)
#Example to show ggtree is working
tmpFile=tempfile()
file<-download.file("https://4va.github.io/biodatasci/data/tree_newick.nwk",tmpFile)
tree<-read.tree(tmpFile)
ggtree::ggtree(tree)
Installing the development Github version of ggtree didn't do the trick, but the above code did.

Error in DataMask$new(.data, caller_env) :
argument "caller_env" is missing, with no default
Can confirm that the problem is fixed when R, ggtree, dplyr, and tidytree are all up to date:
R 4.1.0
ggtree 3.1.2.991
dplyr 1.07
tidytree 0.3.4
I had to update R to 4.1.0 as the above package configuration wouldn't work with 4.0.3 or from 4.0.5

Related

gdalcubes create_image_collection() results in R session Abort after interrupting it

I want to use gdalcubes in order to create a datacube structure in R from locally safe remote sensing data time series. I have tried it on a big data set (~5GB) and the create_image_collection function started, but the process was very slow (11% after three hours) and I couldn't barely use my computer while it was runinng. Therefore, I interrupted the process in a very brutal way (holding power button).
This seems to have been a big mistake, because now the function always result in a 'R Session Abort', even when calling it on a much smaller dataset. I unistalled gdalcubes and reinstalled it, but nothing has changed.
Are there any files I could delete or directories to reset in order to make it work again? I fear there are some files left anywhere in the directory structure that may cause this, but I really don't have no idea of these structures.
Thanks for any help, I really need this package!
See question on GitHub: https://github.com/appelmar/gdalcubes_R/issues/78
> sessionInfo()
R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)
Matrix products: default
locale:
[1] LC_COLLATE=German_Germany.utf8 LC_CTYPE=German_Germany.utf8 LC_MONETARY=German_Germany.utf8 LC_NUMERIC=C LC_TIME=German_Germany.utf8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RPostgres_1.4.4
loaded via a namespace (and not attached):
[1] Rcpp_1.0.9 rstudioapi_0.14 raster_3.6-14 knitr_1.41 hms_1.1.2 rappdirs_0.3.3 bit_4.0.5 here_1.0.1 lattice_0.20-45 rlang_1.0.6
[11] fastmap_1.1.0 blob_1.2.3 tools_4.2.2 grid_4.2.2 xfun_0.36 png_0.1-8 terra_1.6-53 cli_3.4.1 DBI_1.1.3 htmltools_0.5.4
[21] ellipsis_0.3.2 yaml_2.3.6 digest_0.6.31 bit64_4.0.5 rprojroot_2.0.3 lifecycle_1.0.3 Matrix_1.5-1 codetools_0.2-18 vctrs_0.5.1 evaluate_0.20
[31] rmarkdown_2.20 sp_1.5-1 compiler_4.2.2 reticulate_1.26 jsonlite_1.8.4 pkgconfig_2.0.3
after a lot of research and trying around, the simple solution was to install R 4.1.0. In this version of R the package is working perfectly. R session Abort can often be solved by this, probably.

R markdown knitting error and R starting error after installing the packages extrafont, sysfonts and showtext / re-installation of R

In desperation I try to re-establish the ability for knitting markdown skripts, as this is no more possible after installing 3 packages concerning other fonts in graphs. This is what happened:
I worked with R 4.1.0 (2021-05-18) -- "Camp Pontanezen" (and Rstudio) up to yesterday, wrote thousands of rows in R and R markdown (which worked perfectly for several month). In order to change font types in plots I installed the packages extrafont, sysfonts and showtext, without any efforts regarding the ability to change the font in graphs. Without changing ANYTHING in the .Rmd files, these weren't able to be knitted anymore after these installations (there was an error, I can't reproduce at the moment and nothing was knitted).
I thought, uninstalling all packages and/or re-installing R and Rstudio and the packages needed for the skripts would help in this situation, but this was not the case.
case1: (latest version of R, R 4.2.0)
neither I'm able to knit markdown files, nor the start of R works (see error-messages below)
case2: (version of R, that worked before, R 4.1.0)
no error while starting R, but knitting is still unpossible (see error above)
there might be a utf-8 problem, as my username contains a german umlaut (ü), but I had no problems before the installation of these 3 packages! default encoding is UTF-8 in the global options. Maybe the updated versions of other packages not mentioned are also a problem. But it seems, that there's profound disbalance in the whole R system now.
here's my sessionInfo:
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)
Matrix products: default
locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252
[3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
[5] LC_TIME=German_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tidyr_1.2.0 fansi_1.0.3 assertthat_0.2.1 utf8_1.2.2 crayon_1.5.1
[6] dplyr_1.0.9 R6_2.5.1 backports_1.4.1 DBI_1.1.2 lifecycle_1.0.1
[11] magrittr_2.0.3 pillar_1.7.0 rlang_1.0.2 cli_3.3.0 vctrs_0.4.1
[16] generics_0.1.2 ellipsis_0.3.2 tools_4.1.0 glue_1.6.2 purrr_0.3.4
[21] broom_0.8.0 compiler_4.1.0 pkgconfig_2.0.3 tidyselect_1.1.2 tibble_3.1.7
I don't know what to do next.

Can't Load kableExtra After Installation

I apologize in advance if I could've formatted this better - I am new to Stack Overflow. I am trying to install the kableExtra package. While I'm able to install it, I keep getting this error message when trying to load the package. How exactly can I fix this?
install.packages("kableExtra", dependencies = TRUE)
library(kableExtra)
Error: package or namespace load failed for ‘kableExtra’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Users/tirdodbehbehani/Library/R/3.6/library/systemfonts/libs/systemfonts.so':
dlopen(/Users/tirdodbehbehani/Library/R/3.6/library/systemfonts/libs/systemfonts.so, 6): Library not loaded: /opt/X11/lib/libfreetype.6.dylib
Referenced from: /Users/tirdodbehbehani/Library/R/3.6/library/systemfonts/libs/systemfonts.so
Reason: image not found
In addition: Warning message:
package ‘kableExtra’ was built under R version 3.6.2
sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Catalina 10.15.7
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rlang_0.4.11 hms_1.1.0
loaded via a namespace (and not attached):
[1] pillar_1.6.1 compiler_3.6.1 tools_3.6.1 digest_0.6.27
[5] evaluate_0.14 lifecycle_1.0.0 tibble_3.1.2 pkgconfig_2.0.3
[9] DBI_1.1.1 rstudioapi_0.13 yaml_2.2.1 xfun_0.24
[13] dplyr_1.0.6 httr_1.4.2 stringr_1.4.0 knitr_1.33
[17] xml2_1.3.2 generics_0.1.0 vctrs_0.3.8 tidyselect_1.1.1
[21] glue_1.4.2 R6_2.5.0 fansi_0.5.0 rmarkdown_2.9.1
[25] purrr_0.3.4 magrittr_2.0.1 scales_1.1.1 ellipsis_0.3.2
[29] htmltools_0.5.1.1 assertthat_0.2.1 rvest_1.0.0 colorspace_2.0-2
[33] utf8_1.2.1 stringi_1.6.2 munsell_0.5.0 crayon_1.4.1
You appear to have a broken copy of the systemfonts package. You could try reinstalling it before installing kableExtra, but it might fail to install, because you also appear to be missing the /opt/X11/lib/libfreetype.6.dylib dynamic library. You may need to install that: but I can't suggest how to do that without knowing more about your system.
You edited your question to include the result of running sessionInfo(); thanks! What that tells me is that you're running on a Mac: so you would install XQuartz to get the X11 libs. I think that should get you libfreetype.
I also see that you are running R version 3.6.1. That's 2 years old, and current packages may not be available for it. It's generally a good idea to stay current, and R 4.1.0 was recently released, so I'd suggest updating to that version. Before you update, run pkgnames <- rownames(installed.packages(priority = "NA")); dput(pkgnames) and save the results to a file. Then update R, and run
pkgnames <- [ the long string you saved ]
install.packages(pkgnames)
to install the latest versions of any contributed packages you were using.

Fail to install tdplyr package. error: argument is not an environment

thanks for checking out my very first post. please bear with my formatting.
Issue summary: I have been using tdplyr to access teradata database with no issue until I tested another package called dplyr.teradata for potential performance enhancement. However I can no longer connect to the database due to the following error messages:
Error: package or namespace load failed for 'tdplyr':.onLoad failed
in loadNamespace() for 'tdplyr', details:
call: parent.env(from)
error: argument is not an environment
so I deleted the dplyr.teradata package, thought that would allow my original tdplyr to work, but I still get the same error message above. then I deleted the tdplyr package without backup, trying to reinstall using the original script below:
install.packages('tdplyr',repos=c('https://teradata-download.s3.amazonaws.com','https://cloud.r-
project.org'))
but fail to install because of the same error again. Hope someone could advise on fix.
My sessioninfo is below:
sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 16299)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rlang_0.4.10 teradatasql_17.0.0.8 odbc_1.3.0 dplyr_1.0.2
[5] dbplyr_2.0.0 digest_0.6.27 DBI_1.1.0 hms_0.5.3
[9] bit64_4.0.5 bit_4.0.4
loaded via a namespace (and not attached):
[1] Rcpp_1.0.5 rstudioapi_0.13 magrittr_1.5 tidyselect_1.1.0 R6_2.4.1
[6] blob_1.2.1 tools_4.0.3 xfun_0.20 tinytex_0.28 ellipsis_0.3.1
[11] assertthat_0.2.1 tibble_3.0.4 lifecycle_0.2.0 crayon_1.3.4 zip_2.1.1
[16] purrr_0.3.4 vctrs_0.3.6 glue_1.4.2 openxlsx_4.2.3 stringi_1.5.3
[21] compiler_4.0.3 pillar_1.4.6 generics_0.0.2 pkgconfig_2.0.3
found the answer myself. Pasting the answer below.
The Teradata R package is incompatible with dbplyr v2.0.0 and its later versions, which introduced some breaking changes. To use tdplyr, the version of dbplyr package must be v1.4.4. tdplyr should be installed using the following commands from your Terminal (for Linux and Mac) or Command Prompt (for Windows), till a new version that is compatible with dbplyr v2.0.0 and its later versions is released:
Install dbplyr v1.4.4 first. There are various ways to install a specific version of a R package. Teradata recommends using the following command:
Rscript -e "remotes::install_version('dbplyr',version='1.4.4',repos='https://cloud.r-project.org')"
Note: To run this above command, the R package remotes should be present on the client machine.
Next to download and install tdplyr and dependencies automatically, if minimum required versions are not met, specify the Teradata R package repository and CRAN in the repos argument for install.packages.
Rscript -e "install.packages('tdplyr',repos=c('https://teradata-download.s3.amazonaws.com','https://cloud.r-project.org'))"

CRAN notes that files cannot be checked without ‘pandoc’ being installed

In doing final checks on a CRAN package submission, this NOTE comes up:
* checking top-level files ... NOTE
Files ‘README.md’ or ‘NEWS.md’ cannot be checked without ‘pandoc’ being installed.
However, pandoc is definitely installed as I use it regularly, and this package makes frequent use of it in documentation using pkgdown.
> rmarkdown::pandoc_available()
[1] TRUE
> rmarkdown::pandoc_version()
[1] ‘1.19.2.1’
I want to avoid installing pandoc from source because the latest version of pandoc supercedes the version installed with other R packages and causes weird output.
There is a similar question from a few years back but the solutions there are to either:
Install pandoc from source or via the installr package, whereas I already have pandoc installed; and,
Place the two files into .Rbuildignore, however both should be accepted with CRAN submissions now.
This note only comes up when checked using devtools::release() and when using devtools::check(check_version = TRUE), which otherwise passes with no warnings or notes.
The RStudio install of Pandoc:
Sys.getenv('RSTUDIO_PANDOC')
[1] "/Applications/RStudio.app/Contents/MacOS/pandoc"
Which I had previously exported to my ~/.bash_profile:
export PATH="$PATH:/Applications/Rstudio.app/Contents/MacOS/pandoc"
Any ideas?
> sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.2
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] cancensus_0.1.6
loaded via a namespace (and not attached):
[1] Rcpp_0.12.14 rstudioapi_0.7 knitr_1.17 bindr_0.1
[5] xml2_1.1.1 magrittr_1.5 roxygen2_6.0.1 devtools_1.13.4
[9] R6_2.2.2 rlang_0.1.6 httr_1.3.1 stringr_1.2.0
[13] dplyr_0.7.4 tools_3.4.3 hunspell_2.9 git2r_0.20.0
[17] withr_2.1.1 htmltools_0.3.6 rversions_1.0.3 commonmark_1.4
[21] rprojroot_1.2 yaml_2.1.14 digest_0.6.13 assertthat_0.2.0
[25] tibble_1.3.4 crayon_1.3.4 bindrcpp_0.2 curl_3.1
[29] evaluate_0.10.1 memoise_1.1.0 glue_1.2.0 rmarkdown_1.8
[33] stringi_1.1.5 compiler_3.4.3 backports_1.1.0 desc_1.1.1
[37] jsonlite_1.5 pkgconfig_2.0.1
This happens because devtools::release calls devtools::check with check_version = TRUE.
You can also run devtools::check(check_version = TRUE) to trigger the same note.
I think for this part you would need pandoc on your PATH.
(indeed, after adding the existing ...\RStudio\bin\pandoc to my PATH the note is gone)
This question appears to be a duplicate.
Currently no accepted solution at the above linked Q. However, #hrbrmster's suggested solution in that thread: adding the README.md and NEWS.md to the .Rbuildignore remove the NOTES for me.
Current .RBuildignore contents
^pkg_name_here\.Rproj$
^\.Rproj\.user$
^cran-comments\.md$
^CODE_OF_CONDUCT\.md$
^README\.md$
^NEWS\.md$

Resources