0

I am building an R package with some RStan source codes for Bayesian modeling. I succeeded installing the package, but failed to source it in Rstudio via "library". Below are the messages.

# 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

Does anyone have a clue what went wrong and how to fix it? There seems a similar question here, but I am not quite clear about the solution. Thank you very much for your help.

Here are my DESCRIPTION and 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)
Community
  • 1
  • 1
SixSigma
  • 2,808
  • 2
  • 18
  • 21
  • As a first step I would fix `Warning: package ‘Rcpp’ was built under R version 3.2.5` by updating everything. – Roland Aug 19 '16 at 14:08
  • Thank you for the comment. To be honest, I am not sure what that warning means. The R version required by ``Rcpp`` is ``>=3.0.0``. So I assume my R version is fine. Could you elaborate this warning? – SixSigma Aug 19 '16 at 14:10
  • 1
    Rcpp should be build against the R version you use. Update/reinstall it. – Roland Aug 19 '16 at 17:03

0 Answers0