downgrading a package in R - r

I recently installed the forecast package, using install.packages().
The latest version (6.1) has been successfully installed but I want to install the forecast package version 5.9. So I used :
install.packages('http://cran.rstudio.com/src/contrib/Archive/forecast/forecast_5.9.tar.gz', repos=NULL, type='source')
But when using library I get an error:
install.packages('http://cran.rstudio.com/src/contrib/Archive/forecast/forecast_5.9.tar.gz', repos=NULL, type='source')
Installing package into ‘C:/Users/.../Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/src/contrib/Archive/forecast/forecast_5.9.tar.gz'
Content type 'application/x-gzip' length 156982 bytes (153 KB)
downloaded 153 KB
* installing *source* package 'forecast' ...
** package 'forecast' successfully unpacked and MD5 sums checked
** libs
*** arch - i386
Warning: running command 'make -f "Makevars.win" -f "C:/PROGRA~1/R/R-32~1.1/etc/i386/Makeconf" -f "C:/PROGRA~1/R/R-32~1.1/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="forecast.dll" OBJECTS="calcBATS.o calcTBATS.o etsTargetFunction.o etsTargetFunctionWrapper.o etscalc.o etspolyroot.o makeBATSMatrices.o makeTBATSMatrices.o updateMatrices.o updateTBATSMatrices.o"' had status 127
ERROR: compilation failed for package 'forecast'
* removing 'C:/Users/.../Documents/R/win-library/3.2/forecast'
* restoring previous 'C:/Users/.../Documents/R/win-library/3.2/forecast'
Warning in file.copy(lp, dirname(pkgdir), recursive = TRUE, copy.date = TRUE) :
problem copying C:\Users\...\Documents\R\win-library\3.2\00LOCK-forecast\forecast\libs\x64\forecast.dll to C:\Users\...\Documents\R\win-library\3.2\forecast\libs\x64\forecast.dll: Permission denied
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-32~1.1/bin/x64/R" CMD INSTALL -l "C:\Users\...\Documents\R\win-library\3.2" "C:/Users/.../AppData/Local/Temp/RtmpQzO3Zp/downloaded_packages/forecast_5.9.tar.gz"' had status 1
Warning in install.packages :
installation of package ‘C:/Users/.../AppData/Local/Temp/RtmpQzO3Zp/downloaded_packages/forecast_5.9.tar.gz’ had non-zero exit status

Here is the way to install forecast version 5.9(Its not a problem if you have forecast 6.1 already installed,it would install 5.9 separately meaning that you would see two forecast packages in the installed packages ).
Go to the link https://cran.r-project.org/src/contrib/Archive/forecast/
Download forecast 5.9(just click on it,it would start downloading the file.
Now open the R studio,click on install packages and change install from to : Package archive File(and just browse it to the location of zip file).And your package would be installed.
While using the forecast package in my case it didnt work(the function that uses forecast package) when both the forecast package where loaded.So i use forecast 5.9 making sure that 6.1 isnt loaded.
Hope that helps

Related

Unable to install package RGLPK with R Studio Server in AWS

I am trying to install the package RGLPK with an AWS EC2 instance which has R Studio 1.3 and R 4.0 running. I get this result:
> install.packages("Rglpk")
Installing package into ‘/home/rstudio/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/Rglpk_0.6-4.tar.gz'
Content type 'application/x-gzip' length 21753 bytes (21 KB)
==================================================
downloaded 21 KB
* installing *source* package ‘Rglpk’ ...
** package ‘Rglpk’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
/bin/bash: line 0: cd: GLPK: No such file or directory
Makevars:10: recipe for target 'GLPK.ts' failed
make: *** [GLPK.ts] Error 1
ERROR: compilation failed for package ‘Rglpk’
* removing ‘/home/rstudio/R/x86_64-pc-linux-gnu-library/4.0/Rglpk’
Warning in install.packages :
installation of package ‘Rglpk’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpHmQk09/downloaded_packages’
I have found numerous similar errors involving this package. Such as this:
GLPK: No such file or directory error when trying to install R package
There seems to be 3 or 4 solutions, but they involve sudo commands from the terminal window. I am in a virtual machine.
This worked:
In the terminal within R Studio Server:
sudo apt install libglpk-dev
And back in the console, install the R library:
install.packages("Rglpk")
Credit: #AdamErickson from this post:
GLPK: No such file or directory error when trying to install R package

Error when trying to install vcfR in Rstudio

I'm having trouble installing the vcfR package in R studio.
I'm on Ubuntu 18.04.4 LTS in Rstudio and my R version 3.6.3
When I try to install using:
install.packages('vcfR')
I get a non-zero exit status
Installing package into ‘/home/username/R/x86_64-pc-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
trying URL 'http://cran.r-project.org/src/contrib/vcfR_1.11.0.tar.gz'
Content type 'application/x-gzip' length 1453180 bytes (1.4 MB)
==================================================
downloaded 1.4 MB
* installing *source* package ‘vcfR’ ...
** package ‘vcfR’ successfully unpacked and MD5 sums checked
** using staged installation
./configure: 4: ./configure: checkbashisms: not found
Warning in system(cmd) : error in running command
ERROR: configuration failed for package ‘vcfR’
* removing ‘/home/username/x86_64-pc-linux-gnu-library/3.6/vcfR’
Warning in install.packages :
installation of package ‘vcfR’ had non-zero exit status
I'm not really sure where to go from here or what to try to fix it.
This would appear to be due to a simple bug in the package vcfR. In the most recent version its configure script consists of
#!/bin/sh
#
checkbashisms --force
# EOF.
which makes little to no sense. CRAN never noticed because they now have the script checkbashishm (from Debian's devscript package) installed. Someone should tell the maintainer of vcfR to correct this. I'll send him a mail. At a minimum it should change to
if [ -f /usr/bin/checkbashisms ]; then
checkbashisms --force
fi
I found this on github, so apparently it is a general issue:
https://github.com/r-hub/rhub-linux-builders/issues/46
I'm also running Ubuntu 18.04.04, and got the same error message as you. I installed the devscripts package through the terminal using the following code:
sudo apt update
sudo apt install devscripts
I was then able to successfully install vcfR in RStudio.

how to install in R CvM2SL2Test package (Cramer-von Mises Two Sample Test)

I am trying to install the following package CvM2SL2Test in R, but i do not manage to do it. I have tried from CRAN, but it seems that it is not available anymore. In the end, i have tried locally (downloading the package from http://ftp.naist.jp/pub/CRAN/src/contrib/Archive/CvM2SL2Test/) but i am obtaining the following error:
Installing package into ‘C:/Users/David/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
* installing *source* package 'CvM2SL2Test' ...
** package 'CvM2SL2Test' successfully unpacked and MD5 sums checked
** libs
*** arch - i386
Warning: comando ejecutado 'make -f "C:/PROGRA~1/R/R-34~1.4/etc/i386/Makeconf" -f "C:/PROGRA~1/R/R-34~1.4/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="CvM2SL2Test.dll" OBJECTS="CvM2SL2Test.o XCVM.o XCVMTailProb.o XCVMTailProb_EQ.o XCVMTailProb_NE1.o XCVMTailProb_NE2.o XCvMTest.o XFreqFunct.o"' tiene estatus 127
ERROR: compilation failed for package 'CvM2SL2Test'
* removing 'C:/Users/David/Documents/R/win-library/3.4/CvM2SL2Test'
In R CMD INSTALL
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-34~1.4/bin/x64/R" CMD INSTALL -l "C:\Users\David\Documents\R\win-library\3.4" "C:/Users/David/Downloads/CvM2SL2Test_2.0-1.tar.gz"' had status 1
Warning in install.packages :
installation of package ‘C:/Users/David/Downloads/CvM2SL2Test_2.0-1.tar.gz’ had non-zero exit status
Given that i am using windows 10, i have extracted the folder, and used the extention .zip. Then i have been able to obtain the following result:
Installing package into ‘C:/Users/David/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
package ‘CvM2SL2Test’ successfully unpacked and MD5 sums checked
However, when using like library(‘CvM2SL2Test’), I see the following:
library('CvM2SL2Test')
Error in library("CvM2SL2Test") :
‘CvM2SL2Test’ is not a valid installed package
I do not know how to install propery this package in windows 10 in order to use it properly, how can i do it?
Thanks in advance.
You appear to have a problem running the make command. This probably indicates that you don't have the R Tools collection (see https://cloud.r-project.org/bin/windows/Rtools/) installed, or it is not installed properly.

Installation of archived package "prob" not working in R

I'm running R 3.4.2 and R Studio 1.0.153. I want to install the prob package in R. The prob package in an archived file. It is located here. I am trying to install the prob_1.0-0.tar.gz package. I have no problem downloading and opening the package archive file. The code is below, it seems I need to install the fAsianOptions package.
ERROR: dependency 'fAsianOptions' is not available for package 'prob'
* removing 'C:/Users/blake_000/Documents/R/win-library/3.4/prob' Warning in install.packages : running command
'"C:/PROGRA~1/R/R-34~1.2/bin/x64/R" CMD INSTALL -l
"C:\Users\blake_000\Documents\R\win-library\3.4"
"C:/Users/BLAKE_~1/GOOGLE~1/Life/CSUEB/FALL20~1/6204-P~1/RCODE~1/prob_1.0-0.tar.gz"'
had status 1 Warning in install.packages : installation of package
‘C:/Users/BLAKE_~1/GOOGLE~1/Life/CSUEB/FALL20~1/6204-P~1/RCODE~1/prob_1.0-0.tar.gz’
had non-zero exit status
Unfortunately, the fAsianOptions package is also archived. It is located here and I downloaded version fAsianOptions_3010.79.tar.gz. There were a number of dependencies but I installed the required packages (timeDate, timeSeries, etc.)
However, the fAsianOptions package is not installing. The error code reads as follows:
install.packages("C:/Users/blake_000/Google Drive/Life/CSUEB/Fall
2017/6204- Probability/R Code/fAsianOptions_3010.79.tar.gz", repos =
NULL, type = "source") Installing package into
‘C:/Users/blake_000/Documents/R/win-library/3.4’ (as ‘lib’ is
unspecified)
* installing source package 'fAsianOptions' ...
** package 'fAsianOptions' successfully unpacked and MD5 sums checked
** libs
*** arch - i386 Warning: running command 'make -f "Makevars" -f "C:/PROGRA~1/R/R-34~1.2/etc/i386/Makeconf" -f
"C:/PROGRA~1/R/R-34~1.2/share/make/winshlib.mk"
SHLIB="fAsianOptions.dll" SHLIB_LIBADD='$(FLIBS)'
OBJECTS="EBMAsianOptions.o GammaFunctions.o
HypergeometricFunctions.o"' had status 127 ERROR: compilation failed
for package 'fAsianOptions'
* removing 'C:/Users/blake_000/Documents/R/win-library/3.4/fAsianOptions' Warning
in install.packages : running command
'"C:/PROGRA~1/R/R-34~1.2/bin/x64/R" CMD INSTALL -l
"C:\Users\blake_000\Documents\R\win-library\3.4"
"C:/Users/BLAKE_~1/GOOGLE~1/Life/CSUEB/FALL20~1/6204-P~1/RCODE~1/fAsianOptions_3010.79.tar.gz"'
had status 1 Warning in install.packages : installation of package
‘C:/Users/BLAKE_~1/GOOGLE~1/Life/CSUEB/FALL20~1/6204-P~1/RCODE~1/fAsianOptions_3010.79.tar.gz’
had non-zero exit status
I'm hoping that someone can help me to install the fAsianOptions dependency so I can install the prob package. Or, if there's an easier way, please let me know!
I had the same problem. I solved it by installing lower version of R -2.9. prob is available in repository for this version.

Error when installing gpclib

R version 3.2.1
I downloaded gpclib_1.5-5.tar.gz from http://cran.r-project.org/web/packages/gpclib/index.html and attempted to install the package with
install.packages("D:/GIS/gpclib_1.5-5.tar.gz", repos = NULL, type = "source")
I get the error
* installing *source* package 'gpclib' ...
** package 'gpclib' successfully unpacked and MD5 sums checked
** libs
*** arch - i386
Warning: running command 'make -f "D:/R/R-3.2.1/etc/i386/Makeconf" -f "D:/R/R-3.2.1/share/make/winshlib.mk" SHLIB="gpclib.dll" OBJECTS="Rgpc.o gpc.o"' had status 127
ERROR: compilation failed for package 'gpclib'
* removing 'D:/R/R-3.2.1/library/gpclib'
Warning in install.packages :
running command '"D:/R/R-3.2.1/bin/x64/R" CMD INSTALL -l "D:\R\R-3.2.1\library" "D:/GIS/gpclib_1.5-5.tar.gz"' had status 1
Warning in install.packages :
installation of package ‘D:/GIS/gpclib_1.5-5.tar.gz’ had non-zero exit status
How do I troubleshoot this?
Extra Information
I am ultimately trying to create heat maps, and am following this tutorial
http://spatialanalysis.co.uk/wp-content/uploads/2013/04/james_cheshire_ggplot_intro_blog.pdf
You'll need to install Rtools to install the R compiler libraries:
http://cran.r-project.org/bin/windows/Rtools/
Otherwise, R will have issues compiling from source code.

Resources