I am having trouble installing RStan.
> install_rstan <- function() {
+ on.exit(Sys.unsetenv("R_MAKEVARS_USER"))
+ on.exit(Sys.unsetenv("R_MAKEVARS_SITE"), add = TRUE)
+
+ try(remove.packages("rstan"), silent = TRUE)
+ Sys.setenv(R_MAKEVARS_USER = "foobar")
+ Sys.setenv(R_MAKEVARS_SITE = "foobar")
+ install.packages(c("inline", "RcppEigen"))
+ install.packages("Rcpp", type = "source")
+ library(inline)
+ library(Rcpp)
+ src <- '
+ std::vector<std::string> s;
+ s.push_back("hello");
+ s.push_back("world");
+ return Rcpp::wrap(s);
+ '
+ hellofun <- cxxfunction(body = src, includes = '', plugin = 'Rcpp', verbose = FALSE)
+ test <- try(hellofun())
+ if(inherits(test, "try-error")) stop("hello world failed; ask for help on Rcpp list")
+
+ options(repos = c(getOption("repos"),
+ install.packages("rstan", type = 'source', dependencies = FALSE)
+ library(rstan)
+ set_cppo("fast")
+ if (any(grepl("^darwin", R.version$os, ignore.case = TRUE))) {
+ cat('\nCC=clang', 'CXX=clang++ -arch x86_64 -ftemplate-depth-256',
+ file = "~/.R/Makevars", sep = "\n", append = TRUE)
+ }
+ return(invisible(NULL))
+ }
> install_rstan()
Removing package from ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library’
(as ‘lib’ is unspecified)
Error in remove.packages : there is no package called ‘rstan’
Content type 'application/x-gzip' length 90593 bytes (88 Kb)
opened URL
==================================================
downloaded 88 Kb
Content type 'application/x-gzip' length 3885638 bytes (3.7 Mb)
opened URL
==================================================
downloaded 3.7 Mb
The downloaded binary packages are in
/var/folders/x7/mdj6334j0sgbwzzm29x3dds80000gn/T//RtmpDAmpaV/downloaded_packages
Error in loadNamespace(name) : there is no package called ‘devtools’
Called from: eval(expr, envir, enclos)
Browse[1]>
The error seems to be in the devtools part.
Please help.