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
Related
I am working with the R programming language.
I would like to download this library from github : https://github.com/Datactuariat/Rpostal
I entered the following code in R:
# install from github
devtools::install_github("datactuariat/Rpostal")
library(Rpostal)
After this, I tried one of the demo commands:
# Postal Expand
postal_expand("Quatre vignt douze Ave des Champs-Élysées")
But I get the following error:
Loading required package: jsonlite
Error in system(req, intern = TRUE) :
'~/libpostal/src/libpostal' not found
I have a feeling that this is because I did not install the "libpostal C libraries" - but no instructions are provided for doing this in a Windows Environment (I am using Windows).
Can someone please show me what I am doing wrong and how I can fix this problem?
Thanks!
> sessionInfo()
R version 4.1.3 (2022-03-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22000)
Matrix products: default
locale:
[1] LC_COLLATE=English_Canada.1252 LC_CTYPE=English_Canada.1252 LC_MONETARY=English_Canada.1252
[4] LC_NUMERIC=C LC_TIME=English_Canada.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] jsonlite_1.8.0 Rpostal_0.0.0.9000
loaded via a namespace (and not attached):
[1] compiler_4.1.3 prettyunits_1.1.1 remotes_2.4.2 tools_4.1.3 testthat_3.1.4 digest_0.6.29
[7] pkgbuild_1.3.1 pkgload_1.2.4 evaluate_0.15 memoise_2.0.1 lifecycle_1.0.1 rlang_1.0.2
[13] cli_3.3.0 rstudioapi_0.13 curl_4.3.2 yaml_2.3.5 xfun_0.30 fastmap_1.1.0
[19] withr_2.5.0 knitr_1.39 desc_1.4.1 fs_1.5.2 devtools_2.4.3 rprojroot_2.0.3
[25] glue_1.6.2 R6_2.5.1 processx_3.5.3 rmarkdown_2.14 sessioninfo_1.2.2 callr_3.7.0
[31] purrr_0.3.4 magrittr_2.0.2 ps_1.6.0 ellipsis_0.3.2 htmltools_0.5.2 usethis_2.1.6
[37] tinytex_0.40 cachem_1.0.6 crayon_1.5.1 brio_1.1.3
I am trying to install the trackViewer package in R, following the instructions on the Bioconductor websites https://www.bioconductor.org/packages/devel/bioc/vignettes/trackViewer/inst/doc/trackViewer.html.
https://bioconductor.org/packages/release/bioc/html/trackViewer.html
Every time I run the code
if (!require("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("trackViewer")
if (!require("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("Gviz")
I get this error
'getOption("repos")' replaces Bioconductor standard repositories, see '?repositories' for details
replacement repositories:
CRAN: https://cran.rstudio.com/
Bioconductor version 3.15 (BiocManager 1.30.18), R 4.2.1 (2022-06-23)
Warning message:
package(s) not installed when version(s) same as current; use `force = TRUE` to re-install: 'Gviz'
I'm not sure how to circumvent this. I am ultimately looking to create a lollipop plot to showcase mutations in a gene of interest with annotations.
I would appreciate any help with this.
Session info:
R version 4.2.1 (2022-06-23)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.0.1
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib
locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
attached base packages:
[1] grid stats4 stats graphics grDevices utils datasets methods
[9] base
other attached packages:
[1] Rcpp_1.0.9 GenomicRanges_1.48.0 GenomeInfoDb_1.32.3 IRanges_2.30.0
[5] S4Vectors_0.34.0 BiocGenerics_0.42.0 BiocManager_1.30.18
loaded via a namespace (and not attached):
[1] MatrixGenerics_1.8.1 Biobase_2.56.0 httr_1.4.3
[4] bit64_4.0.5 assertthat_0.2.1 BiocFileCache_2.4.0
[7] blob_1.2.3 BSgenome_1.64.0 GenomeInfoDbData_1.2.8
[10] Rsamtools_2.12.0 yaml_2.3.5 progress_1.2.2
[13] pillar_1.8.0 RSQLite_2.2.16 lattice_0.20-45
[16] glue_1.6.2 digest_0.6.29 RColorBrewer_1.1-3
[19] XVector_0.36.0 colorspace_2.0-3 htmltools_0.5.3
[22] Matrix_1.4-1 XML_3.99-0.10 pkgconfig_2.0.3
[25] biomaRt_2.52.0 zlibbioc_1.42.0 purrr_0.3.4
[28] scales_1.2.0 BiocParallel_1.30.3 tibble_3.1.8
[31] KEGGREST_1.36.3 generics_0.1.3 ellipsis_0.3.2
[34] cachem_1.0.6 SummarizedExperiment_1.26.1 GenomicFeatures_1.48.3
[37] cli_3.3.0 magrittr_2.0.3 crayon_1.5.1
[40] memoise_2.0.1 fansi_1.0.3 xml2_1.3.3
[43] tools_4.2.1 prettyunits_1.1.1 hms_1.1.1
[46] BiocIO_1.6.0 lifecycle_1.0.1 matrixStats_0.62.0
[49] stringr_1.4.0 munsell_0.5.0 DelayedArray_0.22.0
[52] AnnotationDbi_1.58.0 Biostrings_2.64.0 compiler_4.2.1
[55] rlang_1.0.4 RCurl_1.98-1.8 rstudioapi_0.13
[58] rjson_0.2.21 rappdirs_0.3.3 htmlwidgets_1.5.4
[61] bitops_1.0-7 restfulr_0.0.15 codetools_0.2-18
[64] DBI_1.1.3 curl_4.3.2 R6_2.5.1
[67] GenomicAlignments_1.32.1 dplyr_1.0.9 rtracklayer_1.56.1
[70] fastmap_1.1.0 bit_4.0.4 utf8_1.2.2
[73] filelock_1.0.2 stringi_1.7.8 parallel_4.2.1
[76] vctrs_0.4.1 png_0.1-7 dbplyr_2.2.1
[79] tidyselect_1.1.2
Here warning message suggests that latest version of the package is already installed and if you want to reinstall the package then use force=TRUE like this :
BiocManager::install("Gviz", force = TRUE)
As the title states, both R and RStudio crash with a 'fatal error' when I try to run
read_parquet('abc.parquet')
For reference, read_parquet() is a function from the arrow() library
Using:
Macbook Pro M1 2020
Macbook Pro M1 2020
R version 4.1.0 (I think it is running through rosetta, activity monitor says 'Intel')
RStudio 1.4.1717
arrow 4.0.1
R sessionInfo():
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/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] arrow_4.0.1 data.table_1.14.0 dplyr_1.0.7 bsts_0.9.6 xts_0.12.1
[6] zoo_1.8-9 BoomSpikeSlab_1.2.4 Boom_0.9.7 MASS_7.3-54 reshape2_1.4.4
[11] DescTools_0.99.42 lubridate_1.7.10
loaded via a namespace (and not attached):
[1] Rcpp_1.0.6 compiler_4.1.0 pillar_1.6.1 plyr_1.8.6 class_7.3-19 tools_4.1.0
[7] bit_4.0.4 boot_1.3-28 tibble_3.1.2 lifecycle_1.0.0 rootSolve_1.8.2.1 lattice_0.20-44
[13] pkgconfig_2.0.3 rlang_0.4.11 Matrix_1.3-3 DBI_1.1.1 rstudioapi_0.13 mvtnorm_1.1-2
[19] expm_0.999-6 xfun_0.24 e1071_1.7-7 stringr_1.4.0 generics_0.1.0 vctrs_0.3.8
[25] bit64_4.0.5 tidyselect_1.1.1 gld_2.6.2 grid_4.1.0 glue_1.4.2 R6_2.5.0
[31] fansi_0.5.0 lmom_2.8 purrr_0.3.4 magrittr_2.0.1 ellipsis_0.3.2 assertthat_0.2.1
[37] Exact_2.1 utf8_1.2.1 tinytex_0.32 stringi_1.6.2 proxy_0.4-26 crayon_1.4.1
Here is a parquet file (one of many) which I am failing to import:
file.parquet
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'
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.