R Studio installing xlsx package - r

I'm trying to install the xlsx package using R Studio but I am encountering some problems. When the installation process starts I am asked the question "Package which is only available in source form, and may need compilation of C/C++/Fortran:‘rJava’ Do you want to attempt to install these from sources?" to which I reply "y".
The program then goes on to download 3 .tar.gz files. I have copied the full code below.
Problem is, I'm not sure what I need to do next in order to complete the installation? Any help is greatly appreciated.
> install.packages("xlsx")
also installing the dependencies ‘rJava’, ‘xlsxjars’
Package which is only available in source form, and may need compilation of C/C++/Fortran:
‘rJava’
Do you want to attempt to install these from sources?
y/n: y
installing the source packages ‘rJava’, ‘xlsxjars’, ‘xlsx’
trying URL 'https://cran.rstudio.com/src/contrib/rJava_0.9-7.tar.gz'
Content type 'application/x-gzip' length 711181 bytes (694 KB)
downloaded 694 KB
trying URL 'https://cran.rstudio.com/src/contrib/xlsxjars_0.6.1.tar.gz'
Content type 'application/x-gzip' length 9477071 bytes (9.0 MB)
downloaded 9.0 MB
trying URL 'https://cran.rstudio.com/src/contrib/xlsx_0.5.7.tar.gz'
Content type 'application/x-gzip' length 312839 bytes (305 KB)
downloaded 305 KB
* installing *source* package 'rJava' ...
** package 'rJava' successfully unpacked and MD5 sums checked
Generate Windows-specific files (src/jvm-w32) ...
make: Entering directory `/cygdrive/c/Users/davish/AppData/Local/Temp/RtmpmOuT4w/R.INSTALL456448961b13/rJ ava/src/jvm-w32'
dlltool --as as -m i386:x86-64 --as-flags --64 --input-def jvm64.def --kill- at --dllname jvm.dll --output-lib libjvm.dll.a
gcc -m64 -O2 -c -o findjava.o findjava.c
gcc -m64 -s -o findjava.exe findjava.o
make: Leaving directory `/cygdrive/c/Users/davish/AppData/Local/Temp/RtmpmOuT4w/R.INSTALL456448961b13/rJ ava/src/jvm-w32'
Find Java...
ERROR*> JavaSoft\{JRE|JDK} can't open registry keys.
ERROR: cannot find Java Development Kit.
Please set JAVA_HOME to specify its location manually
Warning: running command 'sh ./configure.win' had status 1
ERROR: configuration failed for package 'rJava'
* removing 'C:/Program Files/R/R-3.2.2/library/rJava'
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-32~1.2/bin/x64/R" CMD INSTALL -l "C:\Program Files\R\R-3.2.2\library" C:\Users\davish\AppData\Local\Temp\Rtmp2FwjgL/downloaded_packages/rJava_0.9- 7.tar.gz' had status 1
Warning in install.packages :
installation of package ‘rJava’ had non-zero exit status
ERROR: dependency 'rJava' is not available for package 'xlsxjars'
* removing 'C:/Program Files/R/R-3.2.2/library/xlsxjars'
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-32~1.2/bin/x64/R" CMD INSTALL -l "C:\Program Files\R\R-3.2.2\library" C:\Users\davish\AppData\Local\Temp\Rtmp2FwjgL/downloaded_packages/xlsxjars_0.6.1 .tar.gz' had status 1
Warning in install.packages :
installation of package ‘xlsxjars’ had non-zero exit status
ERROR: dependencies 'rJava', 'xlsxjars' are not available for package 'xlsx'
* removing 'C:/Program Files/R/R-3.2.2/library/xlsx'
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-32~1.2/bin/x64/R" CMD INSTALL -l "C:\Program Files\R\R-3.2.2\library" C:\Users\davish\AppData\Local\Temp\Rtmp2FwjgL/downloaded_packages/xlsx_0.5.7.tar .gz' had status 1
Warning in install.packages :
installation of package ‘xlsx’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\davish\AppData\Local\Temp\Rtmp2FwjgL\downloaded_packages’

Please see the error :
ERROR*> JavaSoft\{JRE|JDK} can't open registry keys.
ERROR: cannot find Java Development Kit.
Please set JAVA_HOME to specify its location manually
solution : install jdk

Related

RStudio config.log file not present

I am trying install rentrez in Rstudio and it fails (error below). But I cannot find the config.log to interpret the error. Any help appreciated locating file or installing rentrez. I am doing this with R version R version 3.6.1 (2019-07-05) on Mac OS 10.14.6. Thanks
Error:
install.packages("rentrez") also installing the dependency ‘XML’
>trying URL 'https://cran.rstudio.com/src/contrib/XML_3.98-1.20.tar.gz'
>Content type 'application/x-gzip' length 1600829 bytes (1.5 MB)
downloaded 1.5 MB
>trying URL 'https://cran.rstudio.com/src/contrib/rentrez_1.2.2.tar.gz'
>Content type 'application/x-gzip' length 79029 bytes (77 KB)
downloaded 77 KB
>installing source package ‘XML’ ...
>** package ‘XML’ successfully unpacked and MD5 sums checked **
> using staged installation
> checking for gcc... x86_64-apple-darwin13.4.0-clang checking whether the C compiler works... no
>configure: error: in /private/var/folders/f0/3d9kdp5j09x5xpv5t0_zq6b80000gn/T/Rtmpp98Wvu/R.INSTALLaf61110a6db/XML':
configure: error: C compiler cannot create executables
Seeconfig.log' for more details ERROR: configuration failed for package ‘XML’
>removing ‘/opt/anaconda3/lib/R/library/XML’ Warning in install.packages : installation of package ‘XML’ had non-zero exit status ERROR: dependency ‘XML’ is not available for package ‘rentrez’
removing ‘/opt/anaconda3/lib/R/library/rentrez’ Warning in install.packages : installation of package ‘rentrez’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/f0/3d9kdp5j09x5xpv5t0_zq6b80000gn/T/RtmpxDMasm/downloaded_packages’
Updating HTML index of packages in '.Library' Making 'packages.html' ... done
I have looked for the config.log file in the working directory I am in when I enter the
install.packages("rentrez") command.
I also tried to look for it in /private/var/folders/f0/3d9kdp5j09x5xpv5t0_zq6b80000gn/T/RtmpxDMasm/downloaded_packages’, however RtmpxDMasm/downloaded_packages does not exist. Is it being deleted with the config.log file in the failed install? What should I do next?

Cannot install R-package gdtools or ggiraph in conda after upgrading to OS X Catalina

After upgrading to OS X Catalina and re-installing R (since OS X now have completely migrated to 64-bit), I cannot install the packages ggiraph or gdtools. I have managed to install other packages such as ggplot2 without problem, but these doesn't work for some reason. I am hoping that someone here can help me out.
If I try to install it in R from GitHub I get:
devtools::install_github('davidgohel/ggiraph')
Pop-up:
"Install Build Tools
Building R package from source requires installation of additional build tools.
Do you want to install the additional tools now?"
But I have already install Xcode, so I don't know why I get this...
If I try to install it from CRAN I get:
install.packages("ggiraph")
also installing the dependencies ‘systemfonts’, ‘gdtools’, ‘uuid’
trying URL 'https://cran.rstudio.com/src/contrib/systemfonts_0.1.1.tar.gz'
Content type 'application/x-gzip' length 24379 bytes (23 KB)
==================================================
downloaded 23 KB
trying URL 'https://cran.rstudio.com/src/contrib/gdtools_0.2.1.tar.gz'
Content type 'application/x-gzip' length 32043 bytes (31 KB)
==================================================
downloaded 31 KB
trying URL 'https://cran.rstudio.com/src/contrib/uuid_0.1-2.tar.gz'
Content type 'application/x-gzip' length 46706 bytes (45 KB)
==================================================
downloaded 45 KB
trying URL 'https://cran.rstudio.com/src/contrib/ggiraph_0.7.0.tar.gz'
Content type 'application/x-gzip' length 372907 bytes (364 KB)
==================================================
downloaded 364 KB
installing source package ‘systemfonts’ ...
package ‘systemfonts’ successfully unpacked and MD5 sums checked
using staged installation
Using PKG_CFLAGS=
Using PKG_LIBS=-lfreetype
./configure: line 54: x86_64-apple-darwin13.4.0-clang: command not found
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because freetype2 was not found. Try installing:
deb: libfontconfig1-dev (Debian, Ubuntu, etc)
rpm: fontconfig-devel (Fedora, EPEL)
csw: fontconfig_dev (Solaris)
brew: freetype (OSX)
If freetype2 is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a freetype2.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
ERROR: configuration failed for package ‘systemfonts’
* removing ‘/Users/USER/Anaconda3/anaconda3/lib/R/library/systemfonts’
Warning in install.packages :
installation of package ‘systemfonts’ had non-zero exit status
* installing source package ‘uuid’ ...
* package ‘uuid’ successfully unpacked and MD5 sums checked
* using staged installation
checking for gcc... x86_64-apple-darwin13.4.0-clang
checking whether the C compiler works... no
configure: error: in /private/var/folders/fy/d14lc6rd5nq827m06zkkb1_h0000gn/T/RtmpQUHJ12/R.INSTALL29ed73b7d534/uuid':
configure: error: C compiler cannot create executables
Seeconfig.log' for more details
ERROR: configuration failed for package ‘uuid’
* removing ‘/Users/USER/Anaconda3/anaconda3/lib/R/library/uuid’
Warning in install.packages :
installation of package ‘uuid’ had non-zero exit status
ERROR: dependency ‘systemfonts’ is not available for package ‘gdtools’
* removing ‘/Users/USER/Anaconda3/anaconda3/lib/R/library/gdtools’
Warning in install.packages :
installation of package ‘gdtools’ had non-zero exit status
ERROR: dependencies ‘gdtools’, ‘uuid’ are not available for package ‘ggiraph’
* removing ‘/Users/USER/Anaconda3/anaconda3/lib/R/library/ggiraph’
Warning in install.packages :
installation of package ‘ggiraph’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/fy/d14lc6rd5nq827m06zkkb1_h0000gn/T/RtmpKdtLil/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
If I try to install it from Terminal I get:
conda install -c conda-forge r-ggiraph
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: \
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
Examining backports.functools_lru_cache: 14%|▏| 87/641 [00:00<00:00, 1400.70it/
Examining bcrypt: 14%|███ | 88/641 [00:00<00:00, 1403.40it/s]
Examining sphinxcontrib-serializinghtml: 17%|▏| 106/641 [00:00<00:00, 1307.92it
Examining nss: 17%|████ | 107/641 [00:00<00:00, 1310.62it/s]
Examining clangdev: 22%|████▎ | 144/641 [00:00<00:00, 1233.48it/s]
/ mparing specs that have this dependenc-...**
... and the list of conflicts goes on and on and on...
Any ideas?

R can't find path for sh

Having a critical issue installing packages in R (I'm on Mac OS). I tried installing a package (below) using Rstudio:
> install.packages("igraph")
Installing package into ‘/usr/local/lib/R/3.6/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/igraph_1.2.4.1.tar.gz'
Content type 'application/x-gzip' length 2704004 bytes (2.6 MB)
==================================================
downloaded 2.6 MB
* installing *source* package ‘igraph’ ...
** package ‘igraph’ successfully unpacked and MD5 sums checked
** using staged installation
./configure: line 473: sed: command not found
./configure: line 472: expr: command not found
./configure: line 473: sed: command not found
./configure: line 487: sed: command not found
: error: cannot create .lineno; rerun with a POSIX shell
ERROR: configuration failed for package ‘igraph’
* removing ‘/usr/local/lib/R/3.6/site-library/igraph’
sh: rm: command not found
Warning in install.packages :
installation of package ‘igraph’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/ll/jmydhb6n7jqg5rv_c58jxkkh0000gn/T/Rtmpi1rAL3/downloaded_packages’
I then tried it in R console:
> install.packages("igraph")
Installing package into ‘/usr/local/lib/R/3.6/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cran.ma.imperial.ac.uk/src/contrib/igraph_1.2.4.1.tar.gz'
Content type 'application/x-gzip' length 2704004 bytes (2.6 MB)
==================================================
downloaded 2.6 MB
/usr/local/Cellar/r/3.6.1/lib/R/bin/R: line 143: exec: sh: not found
The downloaded source packages are in
‘/private/var/folders/ll/jmydhb6n7jqg5rv_c58jxkkh0000gn/T/Rtmpq31bYd/downloaded_packages’
Warning messages:
1: In system2(cmd0, args, env = env, stdout = outfile, stderr = outfile, :
error in running command
2: In install.packages("igraph") :
installation of package ‘igraph’ had non-zero exit status
I'm guessing the issue is related to one of my PATH variables. I also tried installing the most recent version of xcode to no avail. Below are the details I can get on my various PATHs:
From Rstudio:
Sys.getenv("PATH")
[1] "/Users/gordon.beattie/.virtualenvs/r-reticulate/bin:/Users/gordon.beattie/.virtualenvs/r-reticulate/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/gordon.beattie/Downloads/R_packages/gliph-master/gliph/bin"
From R console
> Sys.getenv("PATH")
[1] "/usr/local/bin"
From .Renviron
R_LIBS=~/R/library
PAGER=/usr/local/bin/less
PATH=/Users/gordon.beattie/Downloads/R_packages/gliph-master/gliph/bin
PATH=/usr/local/bin
PATH=/usr/local/bin
PATH=/usr/bin
PATH=/bin
PATH=/usr/sbin
PATH=/sbin
PATH=/Users/gordon.beattie/.virtualenvs/r-reticulate/bin
PATH=/Users/gordon.beattie/.virtualenvs/r-reticulate/bin
PATH=/usr/bin:/bin:/usr/sbin
PATH=/sbin
PATH=/usr/local/bin
My system PATH
echo $PATH
/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Additional info:
echo $0
-bash
echo $SHELL
/bin/bash
which sh
/bin/sh

install rgdal in windows

I want to read hdf4(MODIS) files in R using rgdal package, so I downloaded the additional hdf4 drivers by OSGeo4W, and then tried to install rgdal using source. The result is shown below:
install.packages("rgdal",type = "source")
Installing package into ‘C:/Users/dell/Documents/R/win-library/3.3’
(as ‘lib’ is unspecified) trying URL
'https://mirrors.ustc.edu.cn/CRAN/src/contrib/rgdal_1.2-5.tar.gz'
Content type 'application/gzip' length 1652472 bytes (1.6 MB)
downloaded 1.6 MB
installing source package 'rgdal' ...
** package 'rgdal' successfully unpacked and MD5 sums checked Warning: running command 'sh ./configure.win' had status 127 ERROR:
configuration failed for package 'rgdal'
removing 'C:/Users/dell/Documents/R/win-library/3.3/rgdal' Warning in install.packages : running command
'"C:/PROGRA~1/R/R-33~1.3/bin/x64/R" CMD INSTALL -l
"C:\Users\dell\Documents\R\win-library\3.3"
C:\Users\dell\AppData\Local\Temp\Rtmpywb4tp/downloaded_packages/rgdal_1.2-5.tar.gz'
had status 1 Warning in install.packages : installation of package
‘rgdal’ had non-zero exit status
Is this method wrong, or missing some crucial steps? I use R in Windows 10.

downgrading a package in 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

Resources