rstan packages install from github - r

i dont know why i have this error.
since i had aleardy set all of the environment variable, rtools, r, rstudio and home path to D:\DANNY HUANG\Documents correctly
p.s. i set the installation program's path to D disk since i don't have enough space in OS disk,
> install.packages("rstan", repos = "https://cloud.r-project.org/", dependencies = TRUE)
trying URL 'https://cloud.r-project.org/bin/windows/contrib/4.0/rstan_2.21.2.zip'
Content type 'application/zip' length 5225165 bytes (5.0 MB)
downloaded 5.0 MB
package ‘rstan’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in C:\Users\DANNY HUANG\AppData\Local\Temp\Rtmp2D2Wbi\downloaded_packages
>example(stan_model, package = "rstan", run.dontrun = TRUE)
Loading required package: StanHeaders
Loading required package: ggplot2
Error: package or namespace load failed for ‘rstan’:
.onLoad failed in loadNamespace() for 'processx', details:
call: loadNamespace(name)
error: there is no package called ‘ps’

Related

The package Rmpi is already installed, but R returns "Loading required package: Rmpi"

I'm trying to run parallel computing. Hence I install package Rmpi.
install.packages("Rmpi")
require("Rmpi")
Could you please elaborate why there is such error message while I've just installed the package?
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into �C:/Users/Dung Le/Documents/R/win-library/4.0�
(as �lib� is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/Rmpi_0.6-9.zip'
Content type 'application/zip' length 353588 bytes (345 KB)
downloaded 345 KB
package ‘Rmpi’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\Dung Le\AppData\Local\Temp\RtmpGm7Riu\downloaded_packages
Loading required package: Rmpi
Error: package or namespace load failed for �Rmpi�:
.onLoad failed in loadNamespace() for 'Rmpi', details:
call: inDL(x, as.logical(local), as.logical(now), ...)
error: unable to load shared object 'C:/Users/Dung Le/Documents/R/win-library/4.0/Rmpi/libs/x64/Rmpi.dll':
LoadLibrary failure: The specified module could not be found.
PS: I use Windows 10 Pro with version 2004 and build 19041.508. My R is 4.0.2.

Can't install caret package

I'm not sure what's happening here but the caret package is not installing properly. I realize similar problems have been posted before but I can't figure it out.
install.packages("caret")
library(caret)
Error: package or namespace load failed for ‘caret’ in get(Info[i, 1], envir = env):
cannot open file 'C:/Users/John Compton/Documents/R/win-library/3.6/MASS/R/MASS.rdb': No such file or directory
So I've been trying to figure this out. I have the fully updated R 3.6.1, I also ran a thing that I've since lost of like install.packages("caret", repos = "cran/....", c = ("Dependencies", "Suggestions")) which took about 30 minutes and installed like every suggested package, so I don't know what the error could be. How do I fix the error with this package?
Edit: To include the install.package call
> install.packages("caret")
Installing package into ‘C:/Users/John Compton/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/caret_6.0-84.zip'
Content type 'application/zip' length 6237886 bytes (5.9 MB)
downloaded 5.9 MB
package ‘caret’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\John Compton\AppData\Local\Temp\RtmpGuKafa\downloaded_packages
>

R: Error message installing a package, how to get around it?

I am having an error installing XLConnect for R, this is the error message I get:
> install.packages("XLConnect")
Installing package into ‘C:/Users/a_garcia_de_paredes/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/XLConnect_0.2-13.zip'
Content type 'application/zip' length 9633752 bytes (9.2 MB)
downloaded 9.2 MB
package ‘XLConnect’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\a_garcia_de_paredes\AppData\Local\Temp\RtmpKA18my\downloaded_packages
> library("XLConnect")
Loading required package: XLConnectJars
Error: package or namespace load failed for ‘XLConnectJars’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: fun(libname, pkgname)
error: JAVA_HOME cannot be determined from the Registry
Error: package ‘XLConnectJars’ could not be loaded
Is there a way to get around it?

There is a error while loading the library gmodels

> install.packages("gmodels",dependencies = TRUE)
Installing package into ‘C:/Users/OmPrakash/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/gmodels_2.16.2.zip'
Content type 'application/zip' length 74193 bytes (72 KB)
downloaded 72 KB
package ‘gmodels’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in :
C:\Users\OmPrakash\AppData\Local\Temp\RtmpO6JFcq\downloaded_packages
> library(gmodels)
Error: package or namespace load failed for ‘gmodels’ in library.dynam(lib, package, package.lib):
DLL ‘gtools’ not found: maybe not installed for this architecture?
It seems like gtools is not well installed.
You should try manually installing it.
Colin

When Running R Code From Terminal Packages Will Not Load Properly

I am currently working on an R code that uses the YAML package to create a config file. I need to import and use certain packages like any other code but for some reason when I try to run the program on my server at work it does not work properly. I have 4 packages I need but I went ahead an ran the code with just lubridate to keep the output short. If I can load lubridate I am sure I can load the others too.
Here is what I get from the terminal and after that is my code. I know its a bit messy but I am just trying to get it to work right now.
Terminal output: PS I cant post more than 2 links so I am cutting the output some
unable to load shared object '/nfs/aer/prg/r/lib-linux-x86_64/stringi/libs/stringi.so':
/lib64/libc.so.6: version `GLIBC_2.7' not found (required by /nfs/aer/prg/r/lib-linux-x86_64/stringi/libs/stringi.so)
ERROR: lazy loading failed for package ‘evaluate’
* removing ‘/nfs/aer/prg/r/lib-linux-x86_64/evaluate’
* restoring previous ‘/nfs/aer/prg/r/lib-linux-x86_64/evaluate’
ERROR: failed to lock directory ‘/nfs/aer/prg/r/lib-linux-x86_64’ for modifying
Try removing ‘/nfs/aer/prg/r/lib-linux-x86_64/00LOCK-lubridate’
* installing *source* package ‘knitr’ ...
** package ‘knitr’ successfully unpacked and MD5 sums checked
** R
** demo
** inst
** preparing package for lazy loading
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/nfs/aer/prg/r/lib-linux-x86_64/stringi/libs/stringi.so':
/lib64/libc.so.6: version `GLIBC_2.7' not found (required by /nfs/aer/prg/r/lib-linux-x86_64/stringi/libs/stringi.so)
Error : unable to load R code in package ‘knitr’
ERROR: lazy loading failed for package ‘knitr’
* removing ‘/nfs/aer/prg/r/lib-linux-x86_64/knitr’
installation of package ‘knitr’ had non-zero exit status
Error in library(lubridate) : there is no package called ‘lubridate’
Execution halted
Code:
#install.packages('lubridate', repos="http://cran.rstudio.com/")
#install.packages('ggplot2', repos="http://cran.rstudio.com/")
#install.packages('plyr', repos="http://cran.rstudio.com/")
#install.packages('yaml', repos="http://cran.rstudio.com/")
install.packages('lubridate', dependencies = TRUE, repos="http://cran.rstudio.com/")
#install.packages("lubridate", repos="http://cran.rstudio.com/")
#install.packages('ggplot2', dependencies = TRUE, repos="http://cran.rstudio.com/")
#install.packages('plyr', dependencies = TRUE, repos="http://cran.rstudio.com/")
#install.packages('yaml', dependencies = TRUE, repos="http://cran.rstudio.com/")
library(lubridate)
#library(lubridate, lib.loc="Y:/work/anne/bin/R Library")
#library(ggplot2)
#library(plyr)
#library(yaml)
#install.packages("lubridate", repos = "http://cran.rstudio.com/", type="source")
#require(lubridate)
#require(ggplot2)
#require(plyr)
#require(yaml)
# install.packages("lubridate", repos="C:/Users/hadi/Documents/R/R-3.1.1/library")
#library("lubridate")
#install.packages("ggplot2", repos="http://cran.rstudio.com/")
#library("ggplot2")
#install.packages("plyr", repos="http://cran.rstudio.com/")
#library("plyr")
#install.packages("yaml", repos="http://cran.rstudio.com/")
#library("yaml")
#install_github("lubridate")
#install_github("ggplot2")
#install_github("plyr")
#install_github("yaml")
#Set Working Directory
#setwd('~/Desktop/Front End Testing/Binning Data')######
#Read Config File
config = yaml.load_file('BinConfig.yaml')
#Create Dataframe of the data
dataframe<-read.csv(config$db$dataframe)
#Filter up to 5 Variables at a time or as few as 1 or even 0 variables
dataframe<-dataframe[which(dataframe[config$db$filter1VarName]>=config$db$filter1greaterthanorequalto),]
dataframe<-dataframe[which(dataframe[config$db$filter1VarName]<=config$db$filter1lessthanorequalto),]
dataframe<-dataframe[which(dataframe[config$db$filter2VarName]>=config$db$filter2greaterthanorequalto),]
dataframe<-dataframe[which(dataframe[config$db$filter2VarName]<=config$db$filter2lessthanorequalto),]
#If you do not need this many filters just leave as is with "#" in front. You will get an error but it does not affect the program
dataframe<-dataframe[which(dataframe[config$db$filter3VarName]>=config$db$filter3greaterthanorequalto),]
dataframe<-dataframe[which(dataframe[config$db$filter3VarName]<=config$db$filter3lessthanorequalto),]
#If you do not need this many filters just leave as is with "#" in front. You will get an error but it does not affect the program
dataframe<-dataframe[which(dataframe[config$db$filter4VarName]>=config$db$filter4greaterthanorequalto),]
dataframe<-dataframe[which(dataframe[config$db$filter4VarName]<=config$db$filter4lessthanorequalto),]
#If you do not need this many filters just leave as is with "#" in front. You will get an error but it does not affect the program
dataframe<-dataframe[which(dataframe[config$db$filter5VarName]>=config$db$filter5greaterthanorequalto),]
dataframe<-dataframe[which(dataframe[config$db$filter5VarName]<=config$db$filter5lessthanorequalto),]
#Best kept small. This way if you have narrow bins you can still hit the min # of bins
xBinSize<-config$db$xMinBinSize;
#This is the number of bins you want provided the xBinSize allows for the number of bins
minXBins<- config$db$minXBins;
stationColors <- rainbow(length(stations));
plotX<-vector('list',length(stations));
plotY<-vector('list',length(stations));
stn<-stations
#dataframe<-subset(dataframe,ZAngSGR0_XI<2.7)
#Absorption_Angstrom_Exponent_BG_PM10
#For our application change these two red lines below to fit the column name you wissh to use. Name must be the same as in the data frame
rawX <- c(dataframe[paste(c(config$db$XVar), collapse="")][TRUE,1],
dataframe[paste(c(config$db$XVar), collapse="")][TRUE,1]);
rawY <- c(dataframe[paste(c(config$db$YVar), collapse="")][TRUE,1],
dataframe[paste(c(config$db$YVar), collapse="")][TRUE,1]);
dataX <- rawX[!is.na(rawX) & !is.na(rawY)];
dataY <- rawY[!is.na(rawX) & !is.na(rawY)];
# Figure out the bin range and bin size
rX <- range(dataX);
useBinSize <- xBinSize;
rX[1] <- floor(rX[1] / useBinSize) * useBinSize;
rX[2] <- ceiling(rX[2] / useBinSize) * useBinSize;
if ((rX[2] - rX[1]) > useBinSize * minXBins) {
rX <- range(dataX);
useBinSize <- (rX[2] - rX[1]) / minXBins;
}# < useBinSize * minXBins
nBins <- (rX[2] - rX[1]) / useBinSize ;
# Bin the data
bins <- seq(rX[1],rX[2], useBinSize);
outY <- seq(1,nBins);
outX <- seq(1,nBins);#bins
rows<-length(dataX)
outXBin1<-NULL
outXBindims=NULL
for (bin in seq(1,nBins)) {
outY[bin] <- mean(dataY[dataX>=bins[bin] & dataX<bins[bin+1]],na.rm=T);
outXBin1[bin] <- as.data.frame(dataX[dataX>=bins[bin] & dataX<bins[bin+1]]);
outXBindims[bin]<-length(outXBin1[[bin]])
#outYBinF[,bin] <- (dataY[dataX>=bins[bin] & dataX<bins[bin+1]]);
outX[bin] <- mean(c(bins[bin], bins[bin+1]));
#outXBinF[,bin] <- (c(bins[bin], bins[bin+1]));
}
plotX <- data.frame(outX[!is.na(outY)]);
plotY <- data.frame(outY[!is.na(outY)]);
weight<-data.frame(outXBindims[!is.na(outY)]);
DF<-cbind(plotX,plotY,weight)
names(DF)[names(DF)=='outX..is.na.outY..']<-config$db$XVar
names(DF)[names(DF)=='outY..is.na.outY..']<-config$db$YVar
names(DF)[names(DF)=='outXBindims..is.na.outY..']<-config$db$Y2Var
#DF$FrequencyPercent<-(DF[config$db$Y2Var]/(sum(DF[config$db$Y2Var]))*100)
#names(DF)[names(DF)=='FrequencyPercent']<-c("Frequency Percent")
write.csv(DF,config$db$BinnedDataName)
So I ran it with just install.packages() and library.... This is what I got as the error: P.S. I do not have enough reputation to post more than 2 links so I went ahead and make the https htps instead so I can still post the entire thing...
Installing package into ‘/nfs/aer/prg/r/lib-linux-x86_64’
(as ‘lib’ is unspecified)
also installing the dependencies ‘evaluate’, ‘knitr’
trying URL 'htp://cran.rstudio.com/src/contrib/evaluate_0.10.tar.gz'
Content type 'application/x-gzip' length 21914 bytes (21 KB)
downloaded 21 KB
trying URL 'htp://cran.rstudio.com/src/contrib/knitr_1.15.1.tar.gz'
Content type 'application/x-gzip' length 1027808 bytes (1003 KB)
downloaded 1003 KB
trying URL 'htp://cran.rstudio.com/src/contrib/lubridate_1.6.0.tar.gz'
Content type 'application/x-gzip' length 317672 bytes (310 KB)
downloaded 310 KB
installing source package ‘evaluate’ ...
** package ‘evaluate’ successfully unpacked and MD5 sums checked
** R
** preparing package for lazy loading
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/nfs/aer/prg/r/lib-linux-x86_64/stringi/libs/stringi.so':
/lib64/libc.so.6: version `GLIBC_2.7' not found (required by /nfs/aer/prg/r/lib-linux-x86_64/stringi/libs/stringi.so)
ERROR: lazy loading failed for package ‘evaluate’
removing ‘/nfs/aer/prg/r/lib-linux-x86_64/evaluate’
restoring previous ‘/nfs/aer/prg/r/lib-linux-x86_64/evaluate’
ERROR: failed to lock directory ‘/nfs/aer/prg/r/lib-linux-x86_64’ for modifying
Try removing ‘/nfs/aer/prg/r/lib-linux-x86_64/00LOCK-lubridate’
installing source package ‘knitr’ ...
** package ‘knitr’ successfully unpacked and MD5 sums checked
** R
** demo
** inst
** preparing package for lazy loading
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/nfs/aer/prg/r/lib-linux-x86_64/stringi/libs/stringi.so':
/lib64/libc.so.6: version `GLIBC_2.7' not found (required by /nfs/aer/prg/r/lib-linux-x86_64/stringi/libs/stringi.so)
Error : unable to load R code in package ‘knitr’
ERROR: lazy loading failed for package ‘knitr’
removing ‘/nfs/aer/prg/r/lib-linux-x86_64/knitr’
The downloaded source packages are in
‘/tmp/RtmpDtWu7K/downloaded_packages’
Warning messages:
1: In install.packages("lubridate", dependencies = TRUE, repos = "htp://cran.rstudio.com/") :
installation of package ‘evaluate’ had non-zero exit status
2: In install.packages("lubridate", dependencies = TRUE, repos = "htp://cran.rstudio.com/") :
installation of package ‘lubridate’ had non-zero exit status
3: In install.packages("lubridate", dependencies = TRUE, repos = "htp://cran.rstudio.com/") :
installation of package ‘knitr’ had non-zero exit status
Error in library(lubridate) : there is no package called ‘lubridate’
Execution halted
[climate:/aer/work/anne/bin]$ R --slave -f Bin.r
Installing package into ‘/nfs/aer/prg/r/lib-linux-x86_64’
(as ‘lib’ is unspecified)
also installing the dependencies ‘evaluate’, ‘knitr’
trying URL 'htp://cran.rstudio.com/src/contrib/evaluate_0.10.tar.gz'
Content type 'application/x-gzip' length 21914 bytes (21 KB)
downloaded 21 KB
trying URL 'htp://cran.rstudio.com/src/contrib/knitr_1.15.1.tar.gz'
Content type 'application/x-gzip' length 1027808 bytes (1003 KB)
downloaded 1003 KB
trying URL 'htp://cran.rstudio.com/src/contrib/lubridate_1.6.0.tar.gz'
Content type 'application/x-gzip' length 317672 bytes (310 KB)
downloaded 310 KB
installing source package ‘evaluate’ ...
** package ‘evaluate’ successfully unpacked and MD5 sums checked
** R
** preparing package for lazy loading
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/nfs/aer/prg/r/lib-linux-x86_64/stringi/libs/stringi.so':
/lib64/libc.so.6: version `GLIBC_2.7' not found (required by /nfs/aer/prg/r/lib-linux-x86_64/stringi/libs/stringi.so)
ERROR: lazy loading failed for package ‘evaluate’
removing ‘/nfs/aer/prg/r/lib-linux-x86_64/evaluate’
restoring previous ‘/nfs/aer/prg/r/lib-linux-x86_64/evaluate’
ERROR: failed to lock directory ‘/nfs/aer/prg/r/lib-linux-x86_64’ for modifying
Try removing ‘/nfs/aer/prg/r/lib-linux-x86_64/00LOCK-lubridate’
installing source package ‘knitr’ ...
** package ‘knitr’ successfully unpacked and MD5 sums checked
** R
** demo
** inst
** preparing package for lazy loading
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/nfs/aer/prg/r/lib-linux-x86_64/stringi/libs/stringi.so':
/lib64/libc.so.6: version `GLIBC_2.7' not found (required by /nfs/aer/prg/r/lib-linux-x86_64/stringi/libs/stringi.so)
Error : unable to load R code in package ‘knitr’
ERROR: lazy loading failed for package ‘knitr’
removing ‘/nfs/aer/prg/r/lib-linux-x86_64/knitr’
The downloaded source packages are in
‘/tmp/RtmpJUL44H/downloaded_packages’
Warning messages:
1: In install.packages("lubridate", dependencies = TRUE, repos = "htp://cran.rstudio.com/") :
installation of package ‘evaluate’ had non-zero exit status
2: In install.packages("lubridate", dependencies = TRUE, repos = "htp://cran.rstudio.com/") :
installation of package ‘lubridate’ had non-zero exit status
3: In install.packages("lubridate", dependencies = TRUE, repos = "htp://cran.rstudio.com/") :
installation of package ‘knitr’ had non-zero exit status
Error in library(lubridate) : there is no package called ‘lubridate’
Execution halted
Thank you for your patience

Resources