我无法在R中安装Quantstrat软件包

我刚刚下载了r,并且正在尝试下载quantstrat。唯一的问题是,当我运行以下代码时:

install.packages("devtools")   
require(devtools)   
install_github("braverock/blotter") 
install_github("braverock/quantstrat")

我收到此消息错误:

Error: Failed to install 'blotter' from GitHub:
  System command 'R' failed,exit status: 134,stdout + stderr (last 10 lines):
E> dyld: lazy symbol binding failed: Symbol not found: _utimensat
E>   Referenced from: /library/Frameworks/R.framework/Versions/4.0/Resources/lib/libR.dylib (which was built for Mac OS X 10.13)
E>   Expected in: /usr/lib/libSystem.B.dylib
E> 
E> dyld: Symbol not found: _utimensat
E>   Referenced from: /library/Frameworks/R.framework/Versions/4.0/Resources/lib/libR.dylib (which was built for Mac OS X 10.13)
E>   Expected in: /usr/lib/libSystem.B.dylib
E> 
E> /library/Frameworks/R.framework/Resources/bin/build: line 10:   869 Done                    echo 'tools:::.build_packages()'
E>        870 Abort trap: 6           | R_DEFAULT_PACKAGES= LC_COLLATE=C "${R_HOME}/bin/R" --no-restore --no-echo --args ${args}
zhaojiejie 回答:我无法在R中安装Quantstrat软件包

我的解决方案是在R 4.02之上安装R 3.5。然后我在打开Rstudio时按住ctrl选择了3.5。创建构建并将Rtools更新到版本3.5花费了相当多的时间。但是最终我使它正常运行,并且能够毫无问题地运行代码……当然,前提是您也遇到了Datacamp课程的问题。

请参阅此处: https://support.rstudio.com/hc/en-us/articles/200486138-Changing-R-versions-for-RStudio-desktop ... quantstrat working

library(quantstrat)
# Create initdate,from,and to strings
initdate <- "1999-01-01"
from <- "2003-01-01"
to <- "2015-12-31"
# Set the timezone to UTC
Sys.setenv(TZ = "UTC")
# Set the currency to USD 
currency("USD")

# Load the quantmod package
library(quantmod)
# Retrieve SPY from yahoo
getSymbols("SPY",from = from,to = to,src = "yahoo",adjust = T)

# Use stock() to initialize SPY and set currency to USD
stock("SPY",currency = "USD")
本文链接:https://www.f2er.com/1309714.html

大家都在问