R包开发:成功安装但无法加载。为什么?

时间:2016-08-19 13:55:47

标签: r package rstan

我正在使用一些用于贝叶斯建模的RStan源代码构建一个R包。我成功安装了软件包,但未能通过“库”在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

有没有人知道出了什么问题以及如何修复它? There seems a similar question here, but I am not quite clear about the solution。非常感谢你的帮助。

以下是我的描述和NAMESPACE:

# 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)

0 个答案:

没有答案