I am trying to install the quantstrat package in R. I already installed the other packages necessary for quantstrat, below is my session info.
sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=Portuguese_Brazil.1252 LC_CTYPE=Portuguese_Brazil.1252 LC_MONETARY=Portuguese_Brazil.1252 LC_NUMERIC=C
[5] LC_TIME=Portuguese_Brazil.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] blotter_0.12.4 PerformanceAnalytics_1.5.1 FinancialInstrument_1.2.0 foreach_1.4.3 quantmod_0.4-11
[6] TTR_0.23-2 devtools_1.13.4 xts_0.10-0 zoo_1.8-0 lubridate_1.7.1
loaded via a namespace (and not attached):
[1] Rcpp_0.12.13 rstudioapi_0.7 knitr_1.17 magrittr_1.5 lattice_0.20-35 R6_2.2.2 quadprog_1.5-5 stringr_1.2.0
[9] httr_1.3.1 tools_3.4.2 grid_3.4.2 git2r_0.19.0 withr_2.1.0 iterators_1.0.8 yaml_2.1.14 digest_0.6.12
[17] codetools_0.2-15 curl_3.0 memoise_1.1.0 stringi_1.1.5 compiler_3.4.2 boot_1.3-20
when I run the install packages this is what I get:
install.packages("quantstrat", repos="https://github.com/braverock/quantstrat.git")
Installing package into ‘C:/Users/augus/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
Warning in install.packages :
unable to access index for repository https://github.com/braverock/quantstrat.git/src/contrib:
cannot open URL 'https://github.com/braverock/quantstrat.git/src/contrib/PACKAGES'
Warning in install.packages :
package ‘quantstrat’ is not available (for R version 3.4.2)
Warning in install.packages :
unable to access index for repository https://github.com/braverock/quantstrat.git/bin/windows/contrib/3.4:
cannot open URL 'https://github.com/braverock/quantstrat.git/bin/windows/contrib/3.4/PACKAGES'
I have also tried to download a previous version and install it, but with no success, I got it from the followin link:
http://download.r-forge.r-project.org/bin/windows/contrib/3.2/quantstrat_0.9.1739.zip
install.packages("C:/Users/augus/Dropbox/Trading/R/quantstrat_0.9.17392.zip", repos = NULL)
Installing package into ‘C:/Users/augus/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
Warning in install.packages :
cannot open compressed file 'quantstrat/DESCRIPTION', probable reason 'No such file or directory'
Error in install.packages : cannot open the connection
Does someone know what I am doing wrong?
Thanks
Augusto
As noted in the comments above, for completeness here is an answer.
The most straightforward way to install the latest version of quantstrat is via github with devtools (the version of quantstrat on R-forge is now out of date):
library(devtools)
install_github("braverock/quantstrat")
Related
In trying to install the package tidyverse, I get errors in the installation of dependency tidyr.
Here is the tail of the message I get:
cpp11.cpp:31:100: error: ‘unmove’ is not a member of ‘cpp11’
return cpp11::as_sexp(simplifyPieces(cpp11::unmove(cpp11::as_cpp<cpp11::list>(pieces)), cpp11::unmove(cpp11::as_cpp<int>(p)), cpp11::unmove(cpp11::as_cpp<bool>(fillLeft))));
^~~~~~
cpp11.cpp:31:138: error: ‘unmove’ is not a member of ‘cpp11’
return cpp11::as_sexp(simplifyPieces(cpp11::unmove(cpp11::as_cpp<cpp11::list>(pieces)), cpp11::unmove(cpp11::as_cpp<int>(p)), cpp11::unmove(cpp11::as_cpp<bool>(fillLeft))));
^~~~~~
/usr/lib/R/etc/Makeconf:176: recipe for target 'cpp11.o' failed
make: *** [cpp11.o] Error 1
ERROR: compilation failed for package ‘tidyr’
* removing ‘/home/xxx/yyy/tidyr’
Warning in install.packages :
installation of package ‘tidyr’ had non-zero exit status
To my naive eye, it would seem the issue lies with cpp11. I saw a similar question regarding tidyr installation error due to cpp11 compilation error (R tidyr package installation failed due to cpp11 compilation error (expansion pattern x contains no argument packs)), but it was for a RHEL system.
I have the latest version of gcc/c++ installed on my system (4:7.4.0-1ubuntu2.3). The latest version of system dependencies libcurl4-openssl-dev libssl-dev libxml2-dev are also installed.
Here is the output of sessionInfo():
R version 4.0.2 (2020-06-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.5 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=en_CA.UTF-8 LC_NUMERIC=C LC_TIME=en_CA.UTF-8 LC_COLLATE=en_CA.UTF-8 LC_MONETARY=en_CA.UTF-8 LC_MESSAGES=en_CA.UTF-8
[7] LC_PAPER=en_CA.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] rstudioapi_0.11 magrittr_1.5 usethis_1.6.1 devtools_2.3.1 pkgload_1.1.0 R6_2.4.1 rlang_0.4.7 fansi_0.4.1 tools_4.0.2
[10] pkgbuild_1.1.0 sessioninfo_1.1.1 cli_2.0.2 withr_2.2.0 ellipsis_0.3.1 remotes_2.2.0 assertthat_0.2.1 digest_0.6.25 rprojroot_1.3-2
[19] crayon_1.3.4 processx_3.4.3 callr_3.4.3 fs_1.5.0 ps_1.3.3 curl_4.3 testthat_2.3.2 memoise_1.1.0 glue_1.4.1
[28] compiler_4.0.2 desc_1.2.0 backports_1.1.8 prettyunits_1.1.1
It looks like #hadley released an update to tidyr a few days ago, based on the new cpp11 package: https://github.com/tidyverse/tidyr/releases.
For some reason, this caused tidyr to not build for us.
Our (hopefully temporary!) workaround was like this:
(1) Remove dependency on tidyverse. Instead, explicitly depend on the subpackages( like dplyr/ggplot2/etc. )
(2) Install tidyr in the following way:
packageurl <- "https://cran.r-project.org/src/contrib/Archive/tidyr/tidyr_1.1.0.tar.gz"
install.packages(packageurl, repos=NULL, type="source")
Looks like the following commit is addressing this, though not sure when it will be pushed to CRAN: https://github.com/r-lib/cpp11/commit/779669a4d0b07e9f9d9382114f44e4f6ff68eebb
I found the following here: https://github.com/tidyverse/tidyr/issues/1024
The workaround consists in downgrading cpp11 to version 0.1:
devtools::install_version("cpp11", version = "0.1", repos = "http://cran.us.r-project.org")
Based on the answers from #djacobs7, #mkamenet3, and #Leandro R. M. de Marco, I ended up implementing the following solution, which worked for me.
Removing the cpp11 package, which I had installed from cran.
Re-installing the cpp11 package, but this time from github, as it contains the commit mentioned by #mkamenet3.
devtools::install_github("r-lib/cpp11")
Installing tidyr normally
install.packages("tidyr")
Every time I try to download a package from GitHub using devtools I get an error. I'm currently trying to open the elan package:
library(devtools)
devtools::install_github("dalejbarr/elan")
I get the following error:
Installing package into ‘C:/Users/Daniel &
Catherine/Documents/R/win-library/3.6’ (as ‘lib’ is unspecified)
Error: no packages specified The system cannot find the path
specified. Error: Failed to install 'elan' from GitHub: (converted
from warning) installation of package
‘C:/rtemp/Rtmp0gabkG/file5580567f6ac9/elan_0.1.tar.gz’ had non-zero
exit status
I've tried the solutions suggested here and here, but neither fix the problem. I understand that there might be a problem with the spaces in the path name, but there's not much I can do about that (I don't want to set up a new user on my computer just to run devtools).
My SessionInfo() is:
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)
Matrix products: default
locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] devtools_2.2.2 usethis_1.5.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.2 rstudioapi_0.10 magrittr_1.5 pkgload_1.0.2 R6_2.4.0 rlang_0.4.0 tools_3.6.1 pkgbuild_1.0.3 sessioninfo_1.1.1 cli_1.1.0 withr_2.1.2 ellipsis_0.3.0
[13] remotes_2.1.1 assertthat_0.2.1 digest_0.6.21 rprojroot_1.3-2 crayon_1.3.4 processx_3.4.0 callr_3.3.0 fs_1.3.1 ps_1.3.0 curl_3.3 testthat_2.2.1 memoise_1.1.0
[25] glue_1.3.1 compiler_3.6.1 desc_1.2.0 backports_1.1.5 prettyunits_1.0.2
Looking at the source code at https://github.com/dalejbarr/elan/blob/master/DESCRIPTION I found a potential error of format. You could try to clone the repository and debug it manually by removing the extra spaces in front on the XML package import :
DESCRIPTION file
Package: elan
Title: Read ELAN XML files
Version: 0.1
Authors#R: "Dale Barr <dalejbarr3#gmail.com> [aut, cre]"
Description: Read ELAN XML files to tidy output
Depends:
R (>= 3.1.1),
dplyr
Imports:
XML,
plyr
License:
LazyData: true
RoxygenNote: 7.0.2
I tried it in a minimal package and this raise a problem (but the package still compiles without the scripts).
Alternatively you could use the XML(which this small package uses) or the xml2 (as here) package to parse your XML files.
Whenever I try to install any packages in R I now get this error. This didn't used to happen and is new within the last month and seems to be ubiquitous across all packages I try to install.
I am using R studio but the error occurred when I tried to use just R alone, as well. Currently trying to install rscopus package but the error occurs with most all packages I have tried to install.
Thanks.
Console:
installing the source package ‘rscopus’
trying URL 'https://cran.rstudio.com/src/contrib/rscopus_0.6.3.tar.gz'
Content type 'application/x-gzip' length 40422 bytes (39 KB)
==================================================
downloaded 39 KB
Warning in strptime(xx, f <- "%Y-%m-%d %H:%M:%OS", tz = tz) :
unknown timezone 'zone/tz/2018i.1.0/zoneinfo/America/New_York'
* installing *source* package ‘rscopus’ ...
** package ‘rscopus’ successfully unpacked and MD5 sums checked
** R
** inst
** preparing package for lazy loading
Error : object ‘as_tibble’ is not exported by 'namespace:dplyr'
ERROR: lazy loading failed for package ‘rscopus’
* removing
‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rscopus’
Warning in install.packages :
installation of package ‘rscopus’ had non-zero exit status
The downloaded source packages are in ‘/private/var/folders/wz/p_wg38vx11vcp94hhcw5dv_w0000gn/T/RtmpaJeH3b/downloaded_packages’
Sessioninfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS 10.14.1
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] tibble_1.3.4 DescTools_0.99.21 dplyr_0.5.0 car_2.1-4
loaded via a namespace (and not attached):
[1] Rcpp_0.12.11 magrittr_1.5 splines_3.3.2 MASS_7.3-45 lattice_0.20-34
[6] R6_2.2.0 rlang_0.1.6 minqa_1.2.4 tools_3.3.2 nnet_7.3-12
[11] parallel_3.3.2 pbkrtest_0.4-6 grid_3.3.2 nlme_3.1-128 mgcv_1.8-15
[16] quantreg_5.29 DBI_0.5-1 MatrixModels_0.4-1 lme4_1.1-12 assertthat_0.1
[21] manipulate_1.0.1 Matrix_1.2-7.1 nloptr_1.0.4 boot_1.3-18 expm_0.999-2
[26] mvtnorm_1.0-6 SparseM_1.74 foreign_0.8-67
For anyone else with similar issues, I updated to the newest version of R and it seemed to solve the problem.
Thinking back to the origin of the problem, it coincided with updated to OS X Mojave.
I am using R studio on Mac OS and I want to use caret package for some data analysis. However, caret depends on rlang package and when I try to load caret package I get this error -
> library(caret)
Error: package or namespace load failed for ‘caret’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
namespace ‘rlang’ 0.2.2 is already loaded, but >= 0.3.0.1 is required
In addition: Warning message:
package ‘caret’ was built under R version 3.4.4
I removed the rlang package from the UI and tried installing it again but I am facing below issue -
> install.packages("rlang")
trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.4/rlang_0.3.0.1.tgz'
Content type 'application/x-gzip' length 1074663 bytes (1.0 MB)
==================================================
downloaded 1.0 MB
The downloaded binary packages are in
/var/folders/kh/9lkdq11x3sv56717v0700p_r_16f9p/T//RtmplrCvGX/downloaded_packages
> library(rlang)
Error in value[[3L]](cond) :
Package ‘rlang’ version 0.2.2 cannot be unloaded:
Error in unloadNamespace(package) : namespace ‘rlang’ is imported by ‘tidyr’, ‘purrr’, ‘ggplot2’, ‘plotly’, ‘dplyr’, ‘tibble’, ‘pillar’ so cannot be unloaded
In addition: Warning message:
package ‘rlang’ was built under R version 3.4.4
Here is my sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS 10.14
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_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] dummies_1.5.6 ISLR_1.2 mltools_0.3.5 data.table_1.10.4-3 ggplot2_3.0.0.9000 lattice_0.20-35
loaded via a namespace (and not attached):
[1] reshape2_1.4.3 purrr_0.2.4 colorspace_1.3-2 htmltools_0.3.6 viridisLite_0.3.0 yaml_2.1.16 plotly_4.8.0
[8] rlang_0.3.0.1 ModelMetrics_1.2.2 pillar_1.1.0 glue_1.2.0 withr_2.1.2 bindrcpp_0.2 foreach_1.4.4
[15] bindr_0.1 plyr_1.8.4 stringr_1.2.0 munsell_0.5.0 gtable_0.2.0 htmlwidgets_1.2 devtools_1.13.4
[22] codetools_0.2-15 memoise_1.1.0 curl_3.1 Rcpp_0.12.18 scales_1.0.0 jsonlite_1.5 digest_0.6.16
[29] stringi_1.1.6 dplyr_0.7.4 grid_3.4.3 tools_3.4.3 magrittr_1.5 lazyeval_0.2.1 tibble_1.4.2
[36] tidyr_0.7.2 pkgconfig_2.0.1 Matrix_1.2-12 assertthat_0.2.0 httr_1.3.1 iterators_1.0.10 R6_2.2.2
[43] nlme_3.1-131 compiler_3.4.3 git2r_0.21.0
Maybe try this -- Remove rlang, shutdown and restart R, and then reinstall `rlang'.
If you still want to install a specific version of rlang,
1) Go to https://cran.r-project.org/src/contrib/Archive/rlang/
2) Get URL to the specific version you need. (On Chrome, Right click- Copy URL, etc)
3) Start R, install.packages("[URL]", repo=NULL, type="source")
e.g install.packages("https://cran.r-project.org/src/contrib/Archive/rlang/rlang_0.2.2.tar.gz", repo=NULL, type="source")
Please help me to install recharts package in R. The result is:
installation of package ‘recharts’ had non-zero exit status
I am unable to install it.
The code from R console is posted below:
install.packages('recharts', repos = c('http://yihui.name/xran', 'http://cran.rstudio.com'))
Warning in install.packages :
cannot open: HTTP status was '404 Not Found'
Warning in install.packages :
cannot open: HTTP status was '404 Not Found'
Warning in install.packages :
unable to access index for repository http://yihui.name/xran/bin/windows/contrib/3.2
installing the source package ‘recharts’
trying URL 'http://yihui.name/xran/src/contrib/recharts_0.0.3.tar.gz'
Content type 'application/octet-stream' length 899632 bytes (878 KB)
downloaded 878 KB
'D:\Program' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
Warning in install.packages :
running command '"D:/Program Files/R/R-3.2.2/bin/x64/R" CMD INSTALL -l "D:\Program Files\R\R-3.2.2\library" C:\Users\xgf-pc\AppData\Local\Temp\RtmpwDIN6k/downloaded_packages/recharts_0.0.3.tar.gz' had status 1
Warning in install.packages :
installation of package ‘recharts’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\xgf-pc\AppData\Local\Temp\RtmpwDIN6k\downloaded_packages’
My machine information is as following:
sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8 x64 (build 9200)
locale:
[1] LC_COLLATE=Chinese (Simplified)_China.936 LC_CTYPE=Chinese (Simplified)_China.936
[3] LC_MONETARY=Chinese (Simplified)_China.936 LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_China.936
attached base packages:
[1] tcltk stats graphics grDevices utils datasets methods base
other attached packages:
[1] xlsx_0.5.7 xlsxjars_0.6.1 rJava_0.9-7 RODBC_1.3-12 data.table_1.9.6
[6] dplyr_0.4.1 chron_2.3-47 sqldf_0.4-10 RSQLite_1.0.0 DBI_0.3.1
[11] gsubfn_0.6-6 proto_0.3-10 shiny_0.12.2 devtools_1.9.1
loaded via a namespace (and not attached):
[1] Rcpp_0.12.1 rstudioapi_0.3.1 knitr_1.11 magrittr_1.5 xtable_1.8-0
[6] R6_2.1.1 stringr_1.0.0 httr_1.0.0 tools_3.2.2 parallel_3.2.2
[11] htmltools_0.2.6 assertthat_0.1 digest_0.6.8 curl_0.9.3 memoise_0.2.1
[16] mime_0.4 stringi_1.0-1 jsonlite_0.9.17 httpuv_1.3.3
you can try this:
install.packages("recharts",type="source",repos=c("http://yihui.name/xran", "http://cran.rstudio.com"))