我正在构建一个 R 包,其中包含一些用于贝叶斯建模的 RStan 源代码。我成功安装了该软件包,但未能通过“库”在 Rstudio 中获取它。以下是留言。
# first few lines are output for installation.
...
...
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Warning: package ‘Rcpp’ was built under R version 3.2.5
Warning: replacing previous import by ‘rstan::cpp_object_initializer’ when loading ‘BHERM’
Warning: replacing previous import by ‘coda::traceplot’ when loading ‘BHERM’
Warning: replacing previous import by ‘grid::arrow’ when loading ‘BHERM’
Warning: replacing previous import by ‘grid::unit’ when loading ‘BHERM’
* DONE (BHERM)
> library(BHERM)
Loading required package: Rcpp
Error in unloadNamespace(package) :
namespace ‘Rcpp’ is imported by ‘httpuv’, ‘scales’, ‘ggrepel’, ‘rstan’, ‘htmltools’, ‘plyr’ so cannot be unloaded
In addition: Warning message:
package ‘Rcpp’ was built under R version 3.2.5
Error in library(pkg, character.only = TRUE, logical.return = TRUE, lib.loc = lib.loc, :
Package ‘Rcpp’ version 0.12.3 cannot be unloaded
有谁知道出了什么问题以及如何解决?这里似乎有一个类似的问题,但我对解决方案不太清楚。非常感谢您的帮助。
这是我的描述和命名空间:
# DESCRIPTION:
Depends:
R (>= 3.0.2),
Rcpp (>= 0.11.0),
methods
Imports:
ggplot2 (>= 2.0.0),
rstan (>= 2.9.0),
coda,
ggrepel (>= 0.5.1),
gridExtra (>= 2.2.1),
grid
LinkingTo:
StanHeaders (>= 2.9.0),
rstan (>= 2.9.0),
BH (>= 1.60.0),
Rcpp (>= 0.12.0),
RcppEigen
RoxygenNote: 5.0.1
# NAMESPACE:
export(BHERM)
export(post_analysis)
export(plot_dose_pk_EFF)
export(plot_dose_pk_SAF)
export(plot_predict_EFF)
export(plot_predict_SAF)
export(plot_mean_survival)
export(plot_pred_median)
import(Rcpp)
import(ggplot2)
import(rstan)
import(coda)
import(ggrepel)
import(gridExtra)
import(methods)
import(grid)
useDynLib(BHERM, .registration = TRUE)