我正在尝试加载 RQuantLib,但出现以下错误:
> require(RQuantLib)
Loading required package: RQuantLib
Error : .onLoad failed in loadNamespace() for 'RQuantLib', details:
call: if (is.character(qc) && nchar(qc) > 1) {
error: missing value where TRUE/FALSE needed
In addition: Warning message:
running command 'bash -c 'type -p quantlib-config' 2>/dev/null' had status 1
一般来说,我对编程很陌生,所以我不确定这意味着什么。我在 Mac OS Maverick 环境中工作,我下载了最新版本的 RQuantLib (0.3.12),“R Package Installer”说它已安装。(我使用“R CMD INSTALL RQuantLib”从终端安装了 RQuantLib,因为在 R 中使用 install.packages() 不起作用 - 它给了我一个错误,说 QuantLib 未配置,尽管它在终端中运行良好。)我正在从 R 控制台运行 R。QuantLib 工作正常,Rcpp 也是如此。
我检查了 RQuantLib 文件夹中的“NAMESPACE”文档,它说:
import(methods)
importFrom(Rcpp, Rcpp.plugin.maker)
useDynLib(RQuantLib)
exportPattern("*.default")
export(
##--arrays.R
"oldEuropeanOptionArrays",
"EuropeanOptionArrays",
"plotOptionSurface",
##--asian.R
"AsianOption",
##--bermudan.R
"BermudanSwaption",
"summary.G2Analytic",
"summary.HWAnalytic",
"summary.HWTree",
"summary.BKTree",
##--bond.R
"ZeroCouponBond",
"ZeroPriceByYield",
"ZeroYield",
"FixedRateBond",
"FixedRateBondYield",
"FixedRateBondPriceByYield",
"FloatingRateBond",
"ConvertibleZeroCouponBond",
"ConvertibleFixedCouponBond",
"ConvertibleFloatingCouponBond",
"CallableBond",
"FittedBondCurve",
##--calendars.R
"isBusinessDay", "businessDay",
"isHoliday",
"isWeekend",
"isEndOfMonth",
"getEndOfMonth", "endOfMonth",
"adjust",
"advance",
"businessDaysBetween",
"getHolidayList", "holidayList",
"setCalendarContext",
##--dayCounter.R
"dayCount",
"yearFraction",
"setEvaluationDate",
##--discount.R
"DiscountCurve",
"plot.DiscountCurve",
##--implied.R
"EuropeanOptionImpliedVolatility",
"AmericanOptionImpliedVolatility",
"BinaryOptionImpliedVolatility",
##--option.R
"EuropeanOption",
"AmericanOption",
"AmericanOption.default",
"BinaryOption",
"BarrierOption"
)
S3method("plot", "Option")
S3method("print", "Option")
S3method("summary", "Option")
S3method("plot", "Bond")
S3method("print", "Bond")
S3method("summary", "Bond")
如果我尝试指定终端写入它安装 RQuantLib 而需要它的路径,我会收到以下错误:
> require('RQuantLib', lib.loc = "C:/Users/dealmer/Library/R/3.1/library/RQuantLib/libs")
Loading required package: RQuantLib
Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
no library trees found in 'lib.loc'
那么,我是否需要将某些东西从那里移动到其他 R 库所在的位置?(在其他 R 库文件夹所在的文件夹中已经有一个名为“RQuantLib”的文件夹,例如,我在那里找到了 NAMESPACE 文档)终端给我的路径我无法在 Finder 窗口中遵循,因为它不显示“库”文件夹,我不知道如何让它做到这一点。)
这就是 .libPaths() 给我的:
> .libPaths()
[1] "/Users/dealmer/Library/R/3.1/library"
[2] "/Library/Frameworks/R.framework/Versions/3.1/Resources/library"
R 库在 [2] 中。
我试过谷歌搜索,但找不到任何有用的东西。任何帮助将不胜感激。谢谢 - 多姆