How to rebuild the 'indexing' package on MAC OSX - r

I am trying to install 'indexing' package in r: R-Forge
However, It says it is "failed to build" & am looking for a way to fix this? I do not see a download option for the package.... I am currently on MAC OSX Yosemite and trying to load this in the latest R-Studio.
R version 3.1.2 (2014-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods base
When trying to load via r-studio:
install.packages("indexing", repos="http://R-Forge.R-project.org")
> source repository is unavailable to check versions
> Error in install.packages : Line starting '<!DOCTYPE HTML PUBLI ...' is malformed!

Even though the download link on R-forge doesn't appear to work any more (it may say not available for version >= 3.3. etc), you can still install indexing from source on OSX (or any other operating system).
Open a new terminal in OS X, and in a directly of your choice type the following to install indexing:
svn checkout svn://svn.r-forge.r-project.org/svnroot/indexing/
If you did this correctly, type ls in the terminal and you should see a new directory called indexing. Inside this directory is the source code you need to build the indexing package.
Without changing from the current directory, install the dependency R package mmap if you don't already have it (you might have already installed in from CRAN, in which case you may be able to skip this step) with:
R CMD INSTALL indexing/pkg/mmap
Finally, install indexing from source
R CMD INSTALL indexing/pkg/indexing
You should see something like this in the terminal output if successful:
* installing to library ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library’
* installing *source* package ‘indexing’ ...
** libs
make: Nothing to be done for `all'.
installing to /Library/Frameworks/R.framework/Versions/3.3/Resources/library/indexing/libs
** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (indexing)
Enjoy!

Related

Error in installing gtools

I am fairly new to R. I have tried to google my question, and tried a few things, to no avail.
I am working on a MAC * High Sierra version 10.13.5
I am working with R * R version 3.5.0 (2018-04-23) -- "Joy in Playing"
I am unable to install the package "gtools", and I don't know what to do to make it work??
install.packages("gtools", type="source")
Warning: unable to access index for repository https://mirrors.sorengard.com/cran/src/contrib:
cannot open URL 'https://mirrors.sorengard.com/cran/src/contrib/PACKAGES'
Warning message:
package ‘gtools’ is not available (for R version 3.5.0)
I have also tried to install from a file saved on my computer, but this did not work either
library(gtools)
Error: package or namespace load failed for ‘gtools’:
package ‘gtools’ was installed by an R version with different internals; it needs to be reinstalled for use with this R version
You could try specifying a specific repository, for example:
install.packages("gtools", repos="https://cran.rstudio.com/")
Why are you using install from source? typically to install a package u only need to use the command
install.packages("gtools")
Then it will automatically ask u for a mirror to download from. It seems like "gtools" is available for R 3.5, so try to download it from another mirror and it should work.

Compile R package "arulesSequence" for older release

I want to use arulessequences for sequence mining. I have to use it in Oracle R distribution version R 3.3.0 (last released) and The problem is that the last version of the arulesSequences package is R >= 3.3.2. So I get an error for this problem:
Error: this is R 3.3.0, package arulesSequences needs >=3.3.2
So I decided to compile the source code for older release. I downloaded an older package that needs R 3.2.5 or above. And I know that this package is depended to arules. so I have installed it already. I used following instructions to compile the arulessequences package:
in the source directory I run this command:
R CMD build arulesSequences
the output of this command is:
c:\rr\arulesSequences_0.2-17>R CMD build arulesSequences
* checking for file 'arulesSequences/DESCRIPTION' ... OK
* preparing 'arulesSequences':
* checking DESCRIPTION meta-information ... OK
* cleaning src Warning in cleanup_pkg(pkgdir, Log) : unable to run 'make clean' in 'src'
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
* looking to see if a 'data/datalist' file should be added
* building 'arulesSequences_0.2-17.tar.gz'
a file named 'arulesSequences_0.2-17.tar.gz' get created but when I check it as below I get the following as output:
c:\rr\arulesSequences_0.2-17\arulesSequences>R CMD check arulesSequences
* using log directory 'c:/rr/arulesSequences_0.2-17/arulesSequences/arulesSequences.Rcheck'
using R version 3.4.0 (2017-04-21)
using platform: x86_64-w64-mingw32 (64-bit)
using session charset: ISO8859-1
checking for file 'arulesSequences/DESCRIPTION' ... OK
this is package 'arulesSequences' version '0.2-17'
checking package namespace information ... OK
checking package dependencies ... ERROR Package required but not available: 'arules'
See section 'The DESCRIPTION file' in the 'Writing R Extensions'
manual.
* DONE Status: 1 ERROR
I know the arules package is installed and I checked it. It seems the build process is not successful. do you have any idea to help solve this out?
You have to first install c/c++ compiler for R(called gcc) that is under R's additional build tools.
to do that, in RStudio goto File->New File ->c++ File.
It will show the following dialogue:
Then click on yes.
to compile a package under windows, you have to set repo to Null and type to source.
you can use this command to do that:
install.packages("SOURCEADDRESS",type="source",repo=null)
as #EugèneAdell mentioned above you have to first install arules. then arulessequences.
Instead of building, take the archive packages that seem to be ok for your R version and install them. On my Linux, this gives :
wget http://cran.univ-paris1.fr/src/contrib/Archive/arules/arules_1.5-0.tar.gz
R CMD INSTALL $HOME/arules_1.5-0.tar.gz
* installing to library ‘/home/ruser/R-3.2.5/lib64/R/library’
* installing *source* package ‘arules’ ...
...
** testing if installed package can be loaded
* DONE (arules)
wget http://cran.univ-paris1.fr/src/contrib/Archive/arulesSequences/arulesSequences_0.2-17.tar.gz
R CMD INSTALL $HOME/arulesSequences_0.2-17.tar.gz
* installing to library ‘/home/ruser/R-3.2.5/lib64/R/library’
* installing *source* package ‘arulesSequences’ ...
...
** testing if installed package can be loaded
* DONE (arulesSequences)
R
> library(arulesSequences)
Loading required package: arules
Loading required package: Matrix
Attaching package: ‘arules’
Maybe a more recent version for arules is possible, I just took the first one from the 1.5 series.

Installation of package ‘rjags’ had non-zero exit status

S.O.: Linux Ubuntu 14.04 LTS
R: R version 3.2.1 (2015-06-18) -- "World-Famous Astronaut"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: i686-pc-linux-gnu (32-bit)
When I try to install the package rjags, I get the following fatal error:
install.packages("rjags")
Installing package into ‘/home/marco/.rkward/library’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
trying URL 'http://mirrors.softliste.de/cran/src/contrib/rjags_3-15.tar.gz'
Content type 'application/x-gzip' length 66879 bytes (65 KB)
==================================================
downloaded 65 KB
* installing *source* package ‘rjags’ ...
** package ‘rjags’ successfully unpacked and MD5 sums checked
checking for prefix by checking for jags... no
configure: error: "Location of JAGS headers not defined. Use configure arg '--with-jags-include' or environment variable 'JAGS_INCLUDE'"
ERROR: configuration failed for package ‘rjags’
* removing ‘/home/marco/.rkward/library/rjags’
The downloaded source packages are in
‘/tmp/RtmpditLat/downloaded_packages’
Warning message:
In install.packages("rjags") :
installation of package ‘rjags’ had non-zero exit status
Apparently, the first error message is
configure: error: "Location of JAGS headers not defined. Use configure arg '--with-jags-include' or environment variable 'JAGS_INCLUDE'"
How can I solve this?
As a top comment explained, you need JAGS (Just Another Gibbs Sampler) to be installed in your system. Since you're using Ubuntu 14.04, running
sudo apt-get install jags
should be enough. However, in case you're in another distribution (or, for some reason, the code above doesn't work for you), it's a good idea to know how to get JAGS from the source:
Access http://mcmc-jags.sourceforge.net/
Look for the proper version under "Downloads". For instance, Fedora users should look into the Fedora_20 folder of http://download.opensuse.org/repositories/home:/cornell_vrdc/
Don't forget to download both the base as well as the devel versions.
After the installation is successful, you can go back to R (which can stay open during the whole thing, anyway) and install the package you want.
To me, first, I worked with the installation jags by terminal:
sudo apt-get install jags
and then
install.packages("rjags")
And the error was gone.
1) If necessary Download and install R (https://www.r-project.org/) and potentially a user interface to R like R Studio (see here for tips on getting started with R).
2) Download and install JAGS as per operating system requriements. (http://mcmc-jags.sourceforge.net/)
3) Install additional R packages: e.g., in R install.packages("rjags") . In particular, I use the packages rjags to interface with JAGS and coda to process MCMC output.

How to install ggplot2 in R version 3.2.1 for Mac

I just downloaded new Mac versions of R and Rstudio, but am getting the following error message when I try to install ggplot2 through the Rstudio interface. Is there an alternative approach?
> install.packages("ggplot2")
Warning in install.packages :
unable to access index for repository https://cran.rstudio.com/src/contrib
Warning in install.packages :
package ‘ggplot2’ is not available (for R version 3.2.1)
Installing package into ‘/Users/tom.glaser/Library/R/3.2/library’
(as ‘lib’ is unspecified)
Warning in install.packages :
unable to access index for repository https://cran.rstudio.com/src/contrib
Warning in install.packages :
package ‘ggplot2’ is not available (for R version 3.2.1)
Warning in install.packages :
unable to access index for repository https://cran.rstudio.com/bin/macosx/contrib/3.2
Warning message:
package ‘ggplot2’ is not available (for R version 3.2.1)
My session info is:
> sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: x86_64-apple-darwin10.8.0 (64-bit)
Running under: OS X 10.8.5 (Mountain Lion)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.2.1
I don't know if it's significant, but I'm having similar problems with many other packages I've tried, including psych and Hmisc. I was able to install dplyr (version 0.4.2). I tried going back to an earlier version of R, but the Mac versions I found were too old:
https://cran.r-project.org/bin/macosx/old/index-old.html
I solved my problem by going into Rstudio, and clicking on Tools and then Options. I then selected Packages from the pop-up box. This popped up the Package Installation screen, where I clicked on "Change" next to CRAN mirror, and then selected the mirror called USA (CA 1) - University of California, Berkeley.
I got to this problem also, and finally solved it by uncheck the "Use secure download method for HTTP" option in Tools->Global Options->Packages.
If nothing works, try this:
ggplot2 installation on MAC by AMRIT DHILLON
(a) Open https://cran.r-project.org/web/packages/ggplot2/index.html and download ggplot2 (tzg) file for MAC [DIRECT LINK TO DOWNLOAD IS HERE]: https://cran.r-project.org/bin/macosx/mavericks/contrib/3.3/ggplot2_2.2.0.tgz
(b) Open ggplot2.tgz file with Archive Utility and it will be extracted in a Folder.
(c) Copy ggplot2 Folder.
(d) While pressing Option key, Select Go from Finder's Menu, and select and open Library ( Hidden file, only become visible when you select GO while holding Option Key).
(e) From Library go to a Library folder of R: Library > R > 3.3 > Library (Paste ggplot2 folder here)
(f) Restart R and you are good to go.
Regards,
Amrit Dhillon
I also solved the issue by instead of typing it in the script. I went to > tools >install packages > ggplots2 > install. I don't know why that was any different but it installed.

Error in R CMD Check: Packages required but not available

I am trying to create a package. It depends on several packages. I added the imports to the namespace file and the Depends in the description file.
I found possible solutions here and here, but these didn't work- I think because I am on CentOS.
This is what I see on my screen:
[hadoop#localhost RProjects]$ sudo R CMD check TextPreProcess
* using log directory ‘/home/hadoop/RProjects/TextPreProcess.Rcheck’
* using R version 2.15.1 (2012-06-22)
* using platform: x86_64-redhat-linux-gnu (64-bit)
* using session charset: UTF-8
* checking for file ‘TextPreProcess/DESCRIPTION’ ... OK
* checking extension type ... Package
* this is package ‘TextPreProcess’ version ‘1.0’
* checking package namespace information ... OK
* checking package dependencies ... ERROR
Packages required but not available:
‘RWeka’ ‘Snowball’ ‘lsa’ ‘plyr’ ‘snowfall’ ‘tau’ ‘tm’
See the information on DESCRIPTION files in the chapter ‘Creating R
packages’ of the ‘Writing R Extensions’ manual.
I went through Writing R Extentions but I couldn't derive a lot of insight as to how to solve my problem.
It's working now.
What I did was:
add ~/R/x86_64-redhat-linux-gnu-library/2.15 to .libPaths (That's where my R library was)
Detach all libraries in R
Restart the R session. (For multiple sessions, close all of them.)
install the required packages.
Check if the Imports & Exports are correct in the namespace file.
Check if the required fields are available in the Description file. Make sure all dependencies are handled between 'Depends', 'Imports', 'Suggests' and 'Enhances'.
Checked it. R CMD check <pkg>. Built it. R CMD build <pkg>. Installed it. R CMD INSTALL <tarball>.
Done.
I had the same problem because packages were installed but for different R versions.
To solve, I opened the old R version (the one the package was built under), and installed the missing packages under that version and it solved the problem.
E.g.
# Version should match the version your package was built in
R.version
# 3.5.1
install.packages(c('stringr', 'lubridate', 'testthat'))
Tips
If you need to check your R version, simply type R.version
If you need to switch R version, hold control while starting RStudio on windows, or on mac download a very simple application called RSwitch to instantly switch between version (you'll still need to restart the R session with .rs.restartR()

Resources