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'
Related
I want to install additional packages besides the default ones every time I restart my R Session.
I have tried this: options(HTTPUserAgent = sprintf("R/%s R (%s)", getRversion(), paste(getRversion(), R.version$platform, R.version$arch, R.version$os)))
install.packages(c(
'shinydashboard',
'shinyWidgets',
'rlist',
'sortable',
'tidyverse',
'XML',
'DescTools',
'plotly',
'leaflet',
'tidyquant',
'umap'
))
And this options(defaultPackages = c(getOption("defaultPackages"), "tidyquant", ...)) neither of which works. If all I want to do is to install the tidyquant package upon the R Session restart, how do I get it to work inside the Rprofile file?
I would definitely take #dirk-eddelbuettel's advice on this (XY problem), but it is possible if you add this to your .Rprofile:
.First <- function(){
utils::install.packages("tidyquant", repos="https://cran.csiro.au/")
library(tidyquant)
}
(This command is run before any packages are loaded so you need to specify the install.packages function comes from utils).
Not sure if this applies to windows; my system info:
> sessionInfo()
R version 4.1.3 (2022-03-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.4
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib
locale:
[1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8
attached base packages:
[1] graphics grDevices utils datasets stats methods
[7] base
other attached packages:
[1] tidyquant_1.0.4 quantmod_0.4.20
[3] TTR_0.24.3 PerformanceAnalytics_2.0.4
[5] xts_0.12.1 zoo_1.8-10
[7] lubridate_1.8.0
loaded via a namespace (and not attached):
[1] magrittr_2.0.3 tidyselect_1.1.2 munsell_0.5.0
[4] colorspace_2.0-3 lattice_0.20-45 R6_2.5.1
[7] rlang_1.0.2 quadprog_1.5-8 fansi_1.0.3
[10] dplyr_1.0.9 httr_1.4.3 tcltk_4.1.3
[13] tools_4.1.3 grid_4.1.3 gtable_0.3.0
[16] utf8_1.2.2 DBI_1.1.2 cli_3.3.0
[19] ellipsis_0.3.2 assertthat_0.2.1 tibble_3.1.7
[22] lifecycle_1.0.1 crayon_1.5.1 purrr_0.3.4
[25] ggplot2_3.3.6 vctrs_0.4.1 curl_4.3.2
[28] Quandl_2.11.0 glue_1.6.2 compiler_4.1.3
[31] pillar_1.7.0 generics_0.1.2 scales_1.2.0
[34] jsonlite_1.8.0 pkgconfig_2.0.3
>
N.B. Choose your CRAN mirror accordingly (unless you also happen to be in Australia): https://cran.r-project.org/mirrors.html
I am trying to merge three list using library(tidyverse)in R Studio in Mac. However, I get Error: vector memory exhausted (limit reached?).
In addition, I tried also using merge function, it still does not work. I followed different available suggestions such as R on MacOS Error: vector memory exhausted (limit reached?) and vector memory exhausted. This did not help. I am using Mac, OS Mojave 16 GB RAM. Is this happening because of merging large number of rows. Below is the code which I am running to merge lists. Please assist me with this.
MSP_Counts_Ensembl_Normalized <- read.csv(file = "./MSP_Counts_Ensembl_Normalized.csv", stringsAsFactors = FALSE, check.names = FALSE)
dim(MSP_Counts_Ensembl_Normalized)
1] 60639 115
class(MSP_Counts_Ensembl_Normalized)
[1] "data.frame"
Normalized_counts_trim_CSV <- read.csv(file = "./Normalized_counts_trim_CSV.csv", stringsAsFactors = FALSE, check.names = FALSE)
dim(Normalized_counts_trim_CSV)
[1] 32388 46
class(Normalized_counts_trim_CSV)
[1] "data.frame"
Normalized_counts_notrims_CSV <- read.csv(file = "./Normalized_counts_notrims_CSV.csv", stringsAsFactors = FALSE, check.names = FALSE)
dim(Normalized_counts_notrims_CSV)
[1] 52419 50
class(Normalized_counts_notrims_CSV)
[1] "data.frame"
library(tidyverse)
Combined_full_join_v1 <- list(MSP_Counts_Ensembl_Normalized, Normalized_counts_trim_CSV, Normalized_counts_notrims_CSV) %>% reduce(full_join, by = "hgnc_symbol")
sessionInfo()
R version 4.0.0 (2020-04-24)
Platform: x86_64-apple-darwin17.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/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] stats graphics grDevices utils datasets methods base
other attached packages:
[1] forcats_0.5.0 stringr_1.4.0 dplyr_1.0.2 purrr_0.3.4 readr_1.3.1 tidyr_1.1.1
[7] tibble_3.0.3 ggplot2_3.3.2 tidyverse_1.3.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.5 cellranger_1.1.0 pillar_1.4.6 compiler_4.0.0 dbplyr_1.4.4
[6] tools_4.0.0 jsonlite_1.7.0 lubridate_1.7.9 lifecycle_0.2.0 gtable_0.3.0
[11] pkgconfig_2.0.3 rlang_0.4.7 reprex_0.3.0 cli_2.0.2 DBI_1.1.0
[16] rstudioapi_0.11 haven_2.3.1 xfun_0.16 withr_2.2.0 xml2_1.3.2
[21] httr_1.4.2 fs_1.5.0 generics_0.0.2 vctrs_0.3.2 hms_0.5.3
[26] grid_4.0.0 tidyselect_1.1.0 glue_1.4.1 R6_2.4.1 fansi_0.4.1
[31] readxl_1.3.1 modelr_0.1.8 blob_1.2.1 magrittr_1.5 backports_1.1.9
[36] scales_1.1.1 ellipsis_0.3.1 rvest_0.3.6 assertthat_0.2.1 colorspace_1.4-1
[41] tinytex_0.25 stringi_1.4.6 munsell_0.5.0 broom_0.7.0 crayon_1.3.4
Thank you,
Toufiq
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.
I am a novice to R, and I am learning from the Text Mining with R text. I am trying to invoke the following lines. Even though I follow the text, I still get an unpredicted error? I appreciate any help, thank you!
library(dplyr)
library(tidyr)
library(tidytext)
library(textdata)
nrc_joy <- get_sentiments("nrc") %>% filter(sentiment == "joy")
Error in menu(choices = c("Yes", "No"), title= title): menu() cannot be used non-interactively
In my case it worked well, you can share your session information mine is:
sessionInfo()
R version 3.6.0 (2019-04-26)
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
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] textdata_0.3.0 tidytext_0.2.2 tidyr_1.0.0 dplyr_0.8.3
loaded via a namespace (and not attached):
[1] Rcpp_1.0.1 rstudioapi_0.10 magrittr_1.5
[4] rappdirs_0.3.1 hms_0.5.0 tidyselect_0.2.5
[7] lattice_0.20-38 R6_2.4.0 rlang_0.4.0
[10] tools_3.6.0 grid_3.6.0 janeaustenr_0.1.5
[13] assertthat_0.2.1 tibble_2.1.3 lifecycle_0.1.0
[16] crayon_1.3.4 Matrix_1.2-17 readr_1.3.1
[19] purrr_0.3.2 fs_1.3.1 vctrs_0.2.0
[22] tokenizers_0.2.1 SnowballC_0.6.0 zeallot_0.1.0
[25] glue_1.3.1 stringi_1.4.3 compiler_3.6.0
[28] pillar_1.4.1 generics_0.0.2 backports_1.1.4
[31] pkgconfig_2.0.2
Seems to work fine. Did you type the name of the object after you assigned it? It won't print or show an output unless you tell r to display the object or to print() the object. The output is a tibble and its dimension is 689 x 2.
nrc_joy <- get_sentiments("nrc") %>% filter(sentiment == "joy")
nrc_joy
Just click the up arrow next to this answer if it works for you.
Good luck.
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).