1

For reasons that are too long to explain here, I must use R.2.8.1 (unfortunately). I need to have the xlsx package installed on it. Since I am on R 2.8.1, about ten years old, I can't use the latest version of xlsx but an older version, for instance xlsx_0.1.3 from 2010 seems a good choice. However the previous releases per R-CRAN policy are only available in tar.gz. This is very unfortunate to me because I have to use RGui on windows which only accepts .Zip packages in installation. Therefore I tried the following stuff, in vain:

1-I tried to use Rcmd but I get the following error message:

C:\Program Files (x86)\R\R-2.8.1\bin>Rcmd INSTALL C:\Users\username\Downloads\xlsx_0.1.3.tar.gz
 Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at C:\PROGRA~2\R\R-28~1.1/bin/INSTALL line 42.

so I give up on this one.

2-Then I think that the best solution is to convert the package xlsx_0.1.3.tar.gz into a compatible xlsx_0.1.3.zip package by building it using R.2.8.1 but I can't make it. Here is one of the things I have tried so far. I have unziped xlsx_0.1.3.tar.gz and I organized it in the following way, which brought me the furthest:

Documents\xlsx
Documents\xlsx\activate.bat
Documents\xlsx\build_xlsx.bat
Documents\xlsx\R
Documents\xlsx\R\inst
Documents\xlsx\R\man
Documents\xlsx\R\other
Documents\xlsx\R\R
Documents\xlsx\R\DESCRIPTION
Documents\xlsx\R\NAMESPACE    
Documents\xlsx\R\NEWS
Documents\xlsx\R\WISHLIST

inside activate.bat, I wrote:

SET TMP=C:\Users\username\Documents\TOTO\xlsx\tmp
SET TEMP=%TMP%
SET RTOOLSPATH=C:\DEV_307\toto\Rtools
SET RPATH=C:\DEV\toto\R\R-2.8.1
SET PATH=%RTOOLSPATH%\bin;%RTOOLSPATH%\MinGW\bin;%RPATH%\bin;%PATH%

inside build_xlsx.bat, I wrote:

R CMD BUILD R
R CMD check --no-examples --no-tests R
R CMD build --docs=normal --binary R

Then I still get:

C:\Users\username\Documents\TOTO\xlsx>R CMD BUILD R
* checking for file 'R/DESCRIPTION' ... OK
* preparing 'R':
* checking DESCRIPTION meta-information ... OK
* installing the package to re-build vignettes
Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at C:\DEV\toto\R\R-2.8.1/bin/INSTALL line 42.
ERROR
Installation failed.
Removing 'C:/Users/username/Documents/Rinst1210839349'

Thank you for your help

Matt Dnv
  • 1,620
  • 13
  • 23
  • Actually I managed to use read.xls from gdata by reinstalling R2.8.1 and the appropriate Rtools so that I didn't need read.xlsx anymore. For that matter i already add an old gdata and gtools package in zip ready. – Matt Dnv Oct 19 '18 at 14:20

1 Answers1

1

I can't include structured content in comments. This is really a comment.

The structure of source packages (which is what you have with xlsx_0.1.3.tar.gz if you pulled it from the CRAN archives) hasn't changed (much) since 2.8.1.

You'll also need to grab rJava_0.8-3.tar.gz and xlsxjars_0.2.0.tar.gz from the archive as xlsxjars + xlsx rely on rJava.

Extract each (since Windows R 2.8.1 seems to not grok gz files). They should make rJava, xlsxjars and xlsx directories each.

Move to the parent directory of both.

Run:

R CMD javareconf

R CMD build rJava
R CMD INSTALL rJava_0.8-3.zip  # I believe this will be the name

R CMD build xlsxjars
R CMD INSTALL xlsxjars_0.2.0.zip

R CMD build xlsx
R CMD INSTALL xlsx_0.1.3.zip

and you should be gtg.

hrbrmstr
  • 77,368
  • 11
  • 139
  • 205
  • Thanks a lot . Actually I managed to use read.xls from gdata by reinstalling R2.8.1 and the appropriate Rtools so that I didn't need read.xlsx anymore – Matt Dnv Oct 19 '18 at 14:19
  • Awesome. FWIW I'd seriously consider setting up a small CRAN mirror server with binary package builds (it's pretty easy to build binary packages and host them internally in a "CRAN-like" way) so you don't have to deal with source installs. – hrbrmstr Oct 19 '18 at 14:26
  • That would be a great idea indeed! I'm sure lots of people would be grateful to you about this !! I made it because I had an old zip of gdata. Thanks a lot for your very interesting answer anyway, I'm sure other people are going to benefit from it. – Matt Dnv Oct 19 '18 at 15:16