R is throwing errors for semPlot and semPath - r

Update: This problem seems to be unique to Mac
The installation of semPlot seems to go fine, but when I call the library, it throws an error about package 'glasso' not found. When I try to use semPath, it says the function is not found.
Have restarted RStudio countless times. R is up to date as is my computer (MacOS Mojave version 10.14.6).
I tried the solution in an earlier post about restarting RStudio and then installing again and installing XML as well and that did not work either. I included the dependencies argument to make sure it was completely installed although I don't think that has anything to do with it. Code is below including the session info.
install.packages("semPlot", dependencies = TRUE)
library(semPlot)
semPaths(aa.cfa.fitted)
sessionInfo()
Output is as follows:
> install.packages("semPlot", dependencies = TRUE)
trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6/semPlot_1.1.2.tgz'
Content type 'application/x-gzip' length 344192 bytes (336 KB)
==================================================
downloaded 336 KB
The downloaded binary packages are in
/var/folders/9b/fg1p3n5j3_d8wvtpwz1_tvx00000gn/T//RtmpyOIMa0/downloaded_packages
> library(semPlot)
Error: package or namespace load failed for ‘semPlot’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘glasso’
> semPaths(aa.cfa.fitted)
Error in semPaths(aa.cfa.fitted) : could not find function "semPaths"
> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.6
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
Random number generation:
RNG: Mersenne-Twister
Normal: Inversion
Sample: Rounding
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
[7] base
other attached packages:
[1] GPArotation_2014.11-1 nFactors_2.3.3.1
[3] lattice_0.20-38 boot_1.3-23
[5] MASS_7.3-51.4 psych_1.8.12
[7] lavaan_0.6-5
loaded via a namespace (and not attached):
[1] splines_3.6.1 carData_3.0-2 Formula_1.2-3
[4] BDgraph_2.61 stats4_3.6.1 latticeExtra_0.6-28
[7] lisrelToR_0.1.4 pbivnorm_0.6.0 pillar_1.4.2
[10] backports_1.1.4 digest_0.6.21 RColorBrewer_1.1-2
[13] checkmate_1.9.4 minqa_1.2.4 colorspace_1.4-1
[16] htmltools_0.3.6 Matrix_1.2-17 plyr_1.8.4
[19] XML_3.98-1.20 pkgconfig_2.0.3 xtable_1.8-4
[22] corpcor_1.6.9 scales_1.0.0 jpeg_0.1-8
[25] openxlsx_4.1.0.1 fdrtool_1.2.15 lme4_1.1-21
[28] arm_1.10-1 tibble_2.1.3 htmlTable_1.13.2
[31] rockchalk_1.8.144 ggplot2_3.2.1 nnet_7.3-12
[34] lazyeval_0.2.2 mnormt_1.5-5 magrittr_1.5
[37] survival_2.44-1.1 crayon_1.3.4 kutils_1.69
[40] nlme_3.1-141 foreign_0.8-72 truncnorm_1.0-8
[43] regsem_1.3.9 data.table_1.12.2 tools_3.6.1
[46] stringr_1.4.0 munsell_0.5.0 cluster_2.1.0
[49] zip_2.0.4 compiler_3.6.1 sem_3.1-9
[52] rlang_0.4.0 grid_3.6.1 nloptr_1.2.1
[55] rstudioapi_0.10 htmlwidgets_1.3 igraph_1.2.4.1
[58] Rsolnp_1.16 base64enc_0.1-3 mi_1.0
[61] gtable_0.3.0 abind_1.4-5 reshape2_1.4.3
[64] gridExtra_2.3 knitr_1.25 Hmisc_4.2-0
[67] stringi_1.4.3 matrixcalc_1.0-3 parallel_3.6.1
[70] Rcpp_1.0.2 rpart_4.1-15 acepack_1.4.1
[73] png_0.1-7 xfun_0.10 coda_0.19-3

What about installing glasso first?
install.packages("glasso")
install.packages("semPlot")
I assume that this should solve it (no MacOS around to test, sorry).

Related

What is causing this error: "Failed to retrieve package sources for XML"

What is causing this error: "Failed to retrieve package sources for XML"? I'm trying to publish an example dashboard to R Connect.
[Connect] 2020/12/10 16:40:00.827991448 Error in getSourceForPkgRecord(pkgRecord, srcDir(project), availablePackagesSource(repos = repos), : Failed to retrieve package sources for XML 3.99-0.5 from CRAN (internet connectivity issue?) [3.99-0.3 is current]
[Connect] Build error: A required R package was found in the package repository, but the specified version is not available. (r-package-version-not-available)
Application deployment failed with error: A required R package was found in the package repository, but the specified version is not available. (r-package-version-not-available)
I tried removing and then reinstalling XLM and recently updated my R to version 4.0.3. Wondering if that means I need to deprecate down to 3.99 for XML?
Repo info
> options('repos')
$repos
CRAN
"https://cran.rstudio.com/"
attr(,"RStudio")
[1] TRUE
Session info
> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
Random number generation:
RNG: Mersenne-Twister
Normal: Inversion
Sample: Rounding
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] shinydashboard_0.7.1 PerformanceAnalytics_2.0.4 xts_0.12.1
[4] zoo_1.8-8 highcharter_0.8.2 ggplot2_3.3.2
[7] dygraphs_1.1.1.6 dplyr_1.0.2 shiny_1.5.0
loaded via a namespace (and not attached):
[1] tidyselect_1.1.0 purrr_0.3.4 lattice_0.20-41 colorspace_2.0-0 vctrs_0.3.5
[6] generics_0.1.0 htmltools_0.5.0 yaml_2.2.1 rlang_0.4.9 later_1.1.0.1
[11] pillar_1.4.7 glue_1.4.2 withr_2.3.0 TTR_0.24.2 lifecycle_0.2.0
[16] quantmod_0.4.18 stringr_1.4.0 munsell_0.5.0 gtable_0.3.0 htmlwidgets_1.5.2
[21] labeling_0.4.2 fastmap_1.0.1 Cairo_1.5-12.2 httpuv_1.5.4 curl_4.3
[26] broom_0.7.2 Rcpp_1.0.5 xtable_1.8-4 openssl_1.4.3 promises_1.1.1
[31] scales_1.1.1 backports_1.2.0 jsonlite_1.7.1 farver_2.0.3 mime_0.9
[36] askpass_1.1 digest_0.6.27 stringi_1.5.3 rlist_0.4.6.1 grid_4.0.3
[41] quadprog_1.5-8 tools_4.0.3 magrittr_2.0.1 tibble_3.0.4 crayon_1.3.4
[46] tidyr_1.1.2 pkgconfig_2.0.3 ellipsis_0.3.1 rsconnect_0.8.16 data.table_1.13.4
[51] lubridate_1.7.9.2 assertthat_0.2.1 rstudioapi_0.13 R6_2.5.0 igraph_1.2.6
[56] compiler_4.0.3

RStudio 'Fatal error' when running Motif analysis - Troubleshooting advice needed

The following code causes RStudio Desktop on my system to crash and I have no idea why. This code was running without problems about 9 months ago using older versions of R and RStudio.
library("MotIV")
library("org.Dm.eg.db")
library("MotifDb")
# Get all fly gene entrezID from within org.Dm.eg.db
entrez_fly <- keys(org.Dm.eg.db)
# Grab FBgn from org.Dm.eg.db
FBgn_entrez <- mapIds(org.Dm.eg.db, keys=entrez_fly, column="ENSEMBL", keytype="ENTREZID", multiVals="first")
# Remove non-match entries (NAs)
FBgn_entrez <- FBgn_entrez[!is.na(FBgn_entrez)]
# Also get FBgn <-> Symbol pairs
Symbol_FBgn <- mapIds(org.Dm.eg.db, keys=FBgn_entrez, column="SYMBOL", keytype="ENSEMBL", multiVals="first")
refseq_entrez <- toTable(org.Dm.egREFSEQ[entrez_fly])
# e.g. 'Hand'
Hand_motifdb <- query(MotifDb, 'ZEB1')
# #listData extracts a list of all TFBS in motifdb for this gene
Hand_motifs <- Hand_motifdb#listData
x <- motifMatch(Hand_motifs[1], as.list (MotifDb), top=10)
> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin17.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/4.0/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] stats4 parallel stats graphics grDevices utils datasets methods base
other attached packages:
[1] MotifDb_1.30.0 Biostrings_2.56.0 XVector_0.28.0 org.Dm.eg.db_3.11.4 AnnotationDbi_1.50.3 Biobase_2.48.0
[7] MotIV_1.43.0 GenomicRanges_1.40.0 GenomeInfoDb_1.24.2 IRanges_2.22.2 S4Vectors_0.26.1 BiocGenerics_0.34.0
loaded via a namespace (and not attached):
[1] SummarizedExperiment_1.18.2 tinytex_0.26 tidyselect_1.1.0 xfun_0.18
[5] purrr_0.3.4 lattice_0.20-41 vctrs_0.3.4 generics_0.0.2
[9] rtracklayer_1.48.0 blob_1.2.1 XML_3.99-0.5 rlang_0.4.8
[13] pillar_1.4.6 glue_1.4.2 DBI_1.1.0 BiocParallel_1.22.0
[17] bit64_4.0.5 splitstackshape_1.4.8 matrixStats_0.57.0 GenomeInfoDbData_1.2.3
[21] lifecycle_0.2.0 plyr_1.8.6 zlibbioc_1.34.0 zip_2.1.1
[25] memoise_1.1.0 Rcpp_1.0.5 rGADEM_2.36.0 BSgenome_1.56.0
[29] seqLogo_1.54.3 DelayedArray_0.14.1 bit_4.0.4 Rsamtools_2.4.0
[33] digest_0.6.26 stringi_1.5.3 openxlsx_4.2.2 dplyr_1.0.2
[37] grid_4.0.2 tools_4.0.2 bitops_1.0-6 magrittr_1.5
[41] RCurl_1.98-1.2 tibble_3.0.4 RSQLite_2.2.1 crayon_1.3.4
[45] pkgconfig_2.0.3 ellipsis_0.3.1 Matrix_1.2-18 data.table_1.13.2
[49] rstudioapi_0.11 R6_2.4.1 GenomicAlignments_1.24.0 compiler_4.0.2
At this point, I have no idea where to find an issue. RStudio's log file does not contain complaints/issues. It just crashes.
EDIT:
The libraries can be installed with these lines:
First, Bioconductor:
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install(version = "3.11")
Then, the libraries:
BiocManager::install(c("MotIV", "org.Dm.eg.db", "MotifDb"))
EDIT 2: Tested with R (plain) and get the following error:
*** caught segfault ***
address 0x2, cause 'memory not mapped'

Initializing renv causes RStudio to collapse

I recently installed both R and RStudio on a new computer, and wanted to create an RProject. I used to use the package renv before and it worked pretty well so far.
However, when I tried to initialize the renv library it first created all the necessary folders within the Rproject, but then suddenly gives th following error:
Fehler in data[[1]] . Indizierung ausserhalb der Grenzen
Afterwards it says: Fataler Fehler: unable to initialize the JIT
And finally produces a fatal error and collapses.
I already un- and reinstalled both R and RStudio twice, but without success.
Any ideas?
R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
Matrix products: default
locale:
[1] LC_COLLATE=German_Switzerland.1252 LC_CTYPE=German_Switzerland.1252 LC_MONETARY=German_Switzerland.1252
[4] LC_NUMERIC=C LC_TIME=German_Switzerland.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] Rcpp_1.0.5 plyr_1.8.6 compiler_3.6.3 pillar_1.4.3 later_1.0.0 shinyjs_1.1
[7] tools_3.6.3 digest_0.6.25 viridisLite_0.3.0 jsonlite_1.7.0 lifecycle_0.1.0 tibble_2.1.3
[13] gtable_0.3.0 pkgconfig_2.0.3 rlang_0.4.7 shiny_1.4.0 DBI_1.1.0 rstudioapi_0.11
[19] crosstalk_1.0.0 RPostgreSQL_0.6-2 yaml_2.2.1 xfun_0.12 fastmap_1.0.1 stringr_1.4.0
[25] httr_1.4.1 dplyr_0.8.4 vctrs_0.2.3 htmlwidgets_1.5.1 DT_0.12 tidyselect_1.0.0
[31] leaflet_2.0.3 grid_3.6.3 data.table_1.12.8 glue_1.3.1 R6_2.4.1 plotly_4.9.2
[37] reshape2_1.4.3 tidyr_1.0.2 purrr_0.3.3 ggplot2_3.2.1 magrittr_1.5 shinycssloaders_0.3
[43] scales_1.1.0 promises_1.1.0 htmltools_0.5.0 assertthat_0.2.1 mime_0.9 xtable_1.8-4
[49] colorspace_1.4-1 httpuv_1.5.2 config_0.3 tinytex_0.20 stringi_1.4.6 lazyeval_0.2.2
[55] munsell_0.5.0 crayon_1.3.4 ```

Warning in install.packages: converting NULL pointer to R NULL

I just upgraded to R 4.0.0 and I am now trying to reinstall the packages I use. But when I try to do so in RStudio, I have the following warning:
Warning in install.packages: converting NULL pointer to R NULL
I also had this sort of warning later when running a shiny app:
Warning in .Call("rs_registerShinyFunction", params): converting NULL pointer to R NULL
Where does this come from? How can I fix it?
If needed:
> sessionInfo()
R version 4.0.0 (2020-04-24)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.4 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1
locale:
[1] LC_CTYPE=fr_FR.UTF-8 LC_NUMERIC=C
[3] LC_TIME=fr_FR.UTF-8 LC_COLLATE=fr_FR.UTF-8
[5] LC_MONETARY=fr_FR.UTF-8 LC_MESSAGES=fr_FR.UTF-8
[7] LC_PAPER=fr_FR.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] shiny_1.4.0.2 hammer_0.0.0.9000 testthat_2.3.2
loaded via a namespace (and not attached):
[1] xfun_0.13 remotes_2.1.1 shinyjs_1.1 purrr_0.3.4
[5] miniUI_0.1.1.1 htmltools_0.4.0 usethis_1.6.1 yaml_2.2.1
[9] rlang_0.4.6 pkgbuild_1.0.8 later_1.0.0 glue_1.4.0
[13] withr_2.2.0 stringr_1.4.0 htmlwidgets_1.5.1 knitr_1.28
[17] callr_3.4.3 fastmap_1.0.1 golem_0.2.1 httpuv_1.5.2
[21] ps_1.3.3 fansi_0.4.1 Rcpp_1.0.4.6 xtable_1.8-4
[25] promises_1.1.0 backports_1.1.6 DT_0.13 shinyhelper_0.3.2
[29] desc_1.2.0 pkgload_1.0.2 jsonlite_1.6.1 config_0.3
[33] mime_0.9 fs_1.4.1 packrat_0.5.0 digest_0.6.25
[37] stringi_1.4.6 processx_3.4.2 stargazer_5.2.2 rprojroot_1.3-2
[41] here_0.1 cli_2.0.2 tools_4.0.0 dockerfiler_0.1.3
[45] magrittr_1.5 crayon_1.3.4 xml2_1.3.2 prettyunits_1.1.1
[49] shinyBS_0.61 attempt_0.3.1 assertthat_0.2.1 roxygen2_7.1.0
[53] rstudioapi_0.11 R6_2.4.1 compiler_4.0.0
Updating to the last Rstudio version (at least 1.2.5042) fixes the problem. It was noticed in this issue on Github.
To avoid incompatibilities with the new R major version, it might be a good idea to reinstall all the packages with:
installed <- installed.packages()[,1]
install.packages(installed)
This source recommends to install the packages with
Rscript -e 'install.packages(...)'
on the command line instead of RStudio. It seems to be something RStudio-specific.

Installing MXnet on MAC for R

I see that this question has been asked before, however none of the solutions seem to work for me.
I am trying to install mxnet on MacOS Mojave ver 10.14.3 for R. But I just can't get it to work.
I followed the installation instructions on the mxnet website and tried to build from source but to no success. Here's the error I get:
Error: package or namespace load failed for ‘mxnet’:
.onLoad failed in loadNamespace() for 'mxnet', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.5/Resources/library/mxnet/libs/libmxnet.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.5/Resources/library/mxnet/libs/libmxnet.so, 10): Library not loaded: /usr/local/opt/openblas/lib/libopenblasp-r0.3.1.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.5/Resources/library/mxnet/libs/libmxnet.so
Reason: image not found
I tried adding the soft link for openBlas using:
ln -sf /usr/local/opt/openblas/lib/libopenblasp-r0.3.* /usr/local/opt/openblas/lib/libopenblasp-r0.3.1.dylib
but it didn't work. When I run sessioninfo() in R, this is the output I get:
> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS 10.14.3
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.5/Resources/lib/libRlapack.dylib
locale:
[1] en_IE.UTF-8/en_IE.UTF-8/en_IE.UTF-8/C/en_IE.UTF-8/en_IE.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
other attached packages:
[1] usethis_1.4.0 devtools_2.0.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.0 tidyr_0.8.1 prettyunits_1.0.2
[4] ps_1.1.0 visNetwork_2.0.5 assertthat_0.2.0
[7] rprojroot_1.3-2 digest_0.6.18 R6_2.3.0
[10] plyr_1.8.4 backports_1.1.2 ggplot2_3.0.0
[13] pillar_1.3.1 rlang_0.3.1 lazyeval_0.2.1
[16] rstudioapi_0.8 callr_3.0.0 DiagrammeR_1.0.0
[19] desc_1.2.0 downloader_0.4 readr_1.3.1
[22] stringr_1.3.1 htmlwidgets_1.3 igraph_1.2.2
[25] munsell_0.5.0 compiler_3.5.1 influenceR_0.1.0
[28] rgexf_0.15.3 pkgconfig_2.0.2 base64enc_0.1-3
[31] pkgbuild_1.0.2 htmltools_0.3.6 tidyselect_0.2.4
[34] tibble_2.0.1 gridExtra_2.3 XML_3.98-1.16
[37] viridisLite_0.3.0 crayon_1.3.4 dplyr_0.7.6
[40] withr_2.1.2 grid_3.5.1 jsonlite_1.6
[43] gtable_0.2.0 magrittr_1.5 scales_1.0.0
[46] cli_1.0.1 stringi_1.2.4 fs_1.2.6
[49] remotes_2.0.2 viridis_0.5.1 testthat_2.0.1
[52] bindrcpp_0.2.2 brew_1.0-6 RColorBrewer_1.1-2
[55] tools_3.5.1 glue_1.3.0 purrr_0.2.5
[58] hms_0.4.2 Rook_1.1-1 processx_3.2.0
[61] pkgload_1.0.2 yaml_2.2.0 colorspace_1.3-2
[64] sessioninfo_1.1.1 memoise_1.1.0 bindr_0.1.1
Any suggestions as to how I'd fix this?

Resources