R Newbie Confused about Install Packages - r

I am somewhat new to R, and I thought I understood how to install packages from CRAN mirrors and from source files, but now I am stumped. I currently am using R 2.10.0 on a Windows 7 32-bit machine.
I want to try to use the RGoogleAnalytics package found here and am trying to follow the instructions. They instruct us to install both RCurl and the XML packages from omegahat. For example,
install.packages("RCurl", repos = "http://www.omegahat.org/R")
however this does not work, as I get the following error:
Warning message:
In getDependencies(pkgs, dependencies, available, lib) :
package ‘RCurl’ is not available
When I try this instead:
install.packages("RCurl", repos = "http://www.omegahat.org/R", type="source")
I get the following error after the file downloads. I previously had version 1.0 and that is restored.
trying URL 'http://www.omegahat.org/R/src/contrib/RCurl_1.5-0.tar.gz'
Content type 'application/x-gzip' length 735041 bytes (717 Kb)
opened URL
downloaded 717 Kb
* installing *source* package 'RCurl' ...
Warning in system("sh ./configure.win") : sh not found
ERROR: configuration failed for package 'RCurl'
* removing 'C:/PROGRA~1/R/R-210~1.0/library/RCurl'
* restoring previous 'C:/PROGRA~1/R/R-210~1.0/library/RCurl'
The downloaded packages are in
‘C:\Users\Brock\AppData\Local\Temp\Rtmpc9wt5N\downloaded_packages’
Warning message:
In install.packages("RCurl", repos = "http://www.omegahat.org/R", :
installation of package 'RCurl' had non-zero exit status
Without going into details, I haven't been able to use the RGoogleAnalytics package as I get the same error that is found in this post. I simply am trying to exhaust every possible option to get around the error.
Any help or insight you can provide will be greatly appreciated!

The RCurl project page on CRAN says the Windows binary is not available. The ReadMe points you to a page maintained by Professor Ripley, where he provides binaries of RCurl and several other packages that have special build needs on Windows. However, he only provides them for the most recent major revision of R, so you would need to upgrade to R-2.12.0 to install them from his page.
If you want to build packages from source on Windows, you need to install Rtools first. It looks like you haven't done that. Even if you had them installed, it will still require extra steps to build RCurl on Windows... else the Windows binary would already be on CRAN.
Your best bet is probably to upgrade R and install RCurl from Prof. Ripley's page.

You are probably missing the components to build packages under Windows:
http://www.murdoch-sutherland.com/Rtools/

According to RCurl FAQ, either
curl-config is not found in your path
or
curl-config and related devlopment libraries (libcurl) are not installed.

Related

What does this error mean when I try and install the Mosaic package in R?

When I try and install the mosaic package in R studio, I get the following messages:
> install.packages('mosaic', dependencies = TRUE)
Warning in install.packages :
dependencies ‘latticeExtra’, ‘fastR’ are not available
also installing the dependency ‘rgl’
There are binary versions available but the source versions are later:
binary source needs_compilation
rgl 0.100.50 0.100.54 TRUE
mosaic 1.5.0 1.6.0 FALSE
Do you want to install from sources the package which needs compilation? (Yes/no/cancel) No
trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.5/rgl_0.100.50.tgz'
Content type 'application/x-gzip' length 4709273 bytes (4.5 MB)
==================================================
downloaded 4.5 MB
The downloaded binary packages are in
/var/folders/c8/lyjrvw_x18q2trr07z2s7m8w0000gn/T//RtmpOfzCf6/downloaded_packages
installing the source package ‘mosaic’
trying URL 'https://cran.rstudio.com/src/contrib/mosaic_1.6.0.tar.gz'
Content type 'application/x-gzip' length 12425406 bytes (11.8 MB)
==================================================
downloaded 11.8 MB
ERROR: dependency ‘latticeExtra’ is not available for package ‘mosaic’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/mosaic’
Warning in install.packages :
installation of package ‘mosaic’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/c8/lyjrvw_x18q2trr07z2s7m8w0000gn/T/RtmpOfzCf6/downloaded_packages’
How can I avoid this? I have tried saying both Yes and no on the following line:
Do you want to install from sources the package which needs compilation? (Yes/no/cancel) No
And get an error both times. When I say yes and it attempts to install rgl I repeatedly get this message:
You have not agreed to the Xcode license agreements, please run 'sudo xcodebuild -license' from within a Terminal window to review and agree to the Xcode license agreements.
When I run xcodebuild -license in my terminal window it asks me for a password but does not allow me to type anything in the password slot and does not continue to install.
Is there any other way I can install the mosaic package?
I'm clearing a backlog as my semester winds down. Sorry I didn't get to this sooner.
Short answer: a new version of mosaic is on CRAN, and this issue should go away if you install the new version.
The particular issue you were having looks like it was related to an archived package that was suggested (i.e., not required) by the mosaic package. That package is no longer in the dependency list for mosaic.
In general, when I have issues like this, I often find that manually installing the packages listed in imports: and depends: in the DESCRIPTION file of a package will either (a) resolve the problem or (b) identify exactly where the problem lies.
It seems its dependencies are not installed yet. Maybe install the following packages first: latticeExtra and fastR
install.packages("latticeExtra")
install.packages("fastR")

object ‘wrap_plots’ is not exported by 'namespace:patchwork'

I'm trying to download the package "Seurat" in R, the package is installed and it's now in my list of packages.
** testing if installed package keeps a record of temporary installation path
* DONE (patchwork)
The downloaded source packages are in
‘C:\Users\parnian\AppData\Local\Temp\RtmpAVgSd8\downloaded_packages’
But when I try to call it (library(Seurat)) I get the following error:
> library(Seurat)
Error: package or namespace load failed for ‘Seurat’:
object ‘wrap_plots’ is not exported by 'namespace:patchwork'
I read the similar questions and manually installed "patchwork":
> install.packages("patchwork")
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/parnian/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
R also tells me to install Rtools whhich I have, but when I follow these commands:
> writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con = "~/.Renviron")
there are no more folders in rtools40/home . I don't get the usr\bin... in the address above.
but when I want to verify that make can be found (Sys.which("make")), I get this:
> Sys.which("make")
make
""
Also the downloaded packages of Seurat are saved in a location that doesn't even exist in my computer! How is that possible?
How can I fix this?
Thank you
I was having the same problem. Turns out there are two 'patchwork' packages in R somehow. I got a hint that this was the problem from the answer provided here (https://github.com/satijalab/seurat/issues/2818)
The other patchwork has the current update of 2.4. So what you should do is uninstall the current patchwork and use
devtools::install_github("thomasp85/patchwork")
I did this and it fixed the problem!

MacOS Rstudio devtools loading fails

I need to install the package devtools in R on my mac. The R version is 3.2.3.
It gives an error saying
Warning in install.packages :
download had nonzero exit status
Warning in install.packages :
download of package ‘curl’ failed
Other posts addressing similar issues provide solutions to Linux (with the apt-get command, etc) but doesn't seem to have a Mac solution. Highly appreciate if someone with insight can offer some guide here.
The problem pertains to the download, have a look at this discussion. You can consider downloading the package first and installing a package from a local zip file.
install.packages("local_package_file", repos = NULL)
or more specifically:
install.packages("devtools.zip", repos = NULL, type = "source")
as shown on the devtools # GitHub.
You didn't mentioned, but I understand that you have the Xcode installed as well. Alternatively, it could be informative to check if your R compiler has no problems with connecting to the Internet, you can use the code: is.character(getURL("www.google.com")).

Error in R: (Package which is only available in source form, and may need compilation of C/C++/Fortran)

I'm trying to install the 'yaml' and 'stringi' packages in R-Studio, and it keeps giving me these errors:
> install.packages("stringi")
Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘stringi’
These will not be installed
or
> install.packages('yaml')
Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘yaml’
These will not be installed
How can I get these to install properly?
The error is due to R being unable to find a binary version of the package on CRAN, instead only finding a source version of the package and your Windows installation being unable to compile it. Usually this doesn't occur, but in this case was caused by the (temporary) outage of some of the mirrors at CRAN. If you type:
> getOption('repos')
CRAN CRANextra
"http://cran.rstudio.com" "http://www.stats.ox.ac.uk/pub/RWin"
attr(,"RStudio")
[1] TRUE
You will see that R uses "http://cran.rstudio.com" by default to look for a package to download. If you see the cran mirrors web page you can see at the top that "http://cran.rstudio.com" actually redirects you to different servers world wide (I assume according to the geo location).
When I had the above issue, I solved it by manually changing the repo to one of the urls in the link provided. I suggest you use a different country (or even continent) in case you receive the above error.
I provide below some of the urls in case the link above changes:
Brazil http://nbcgib.uesc.br/mirrors/cran/
Italy http://cran.mirror.garr.it/mirrors/CRAN/
Japan http://cran.ism.ac.jp/
South Africa http://r.adu.org.za/
USA https://cran.cnr.Berkeley.edu/
You need to run the function install.packages as follows:
install.packages('<package_name>', repo='http://nbcgib.uesc.br/mirrors/cran/')
#or any other url from the list or link
One of them should then work to install a binary from an alternative mirror.
You need to install RTools to build packages like this (i.e., a source package rather than a binary). After you install Rtools, then try again to install.packages("ggplot2") and R will prompt you with:
Do you want to attempt to install these from source?
y/n:
(see the picture below)
You need to answer y and it will try to compile the package so it can be installed.
Struggled with this issue today, solved it for now by first downloading the windows binary and then installing e.g.
install.packages("https://cran.r-project.org/bin/windows/contrib/3.3/stringi_1.1.1.zip", repos =NULL)
Just go to https://cran.r-project.org/ and then R Binaries/Windows/contrib and copy the url as argument to install.packages()
Install the package from a zip file - downloadable from the r-project website.
In basic R
go to Packages
Install packages from local files.
In RStudio
go to Packages
Install packages
Install from Package Archive File.
I had this issue when using an out-of-date version of R, so no binaries were available. The simple solution was to update my version of R.
Anything worked for me, until I found out my computer had an old version of R installed. Uninstalling everything and installing the newest R version worked!
I had to download the latest version of Rtools:
Go into the downloads folder and double click it to install it.
Close and reopen any R session.
Now packages should install like normal.
However, if you still have trouble, try installing the package from source (using type="source")
Like this:
install.packages("dplyr", type="source")

GenomicFeatures Package Installation Trouble

Sorry to be back so soon with a simple installation question, but my inability to solve it myself is seriously impairing my productivity. Anyway, I tried installing GenomicFeatures as suggested by the BC website.
> source("http://bioconductor.org/biocLite.R")
> biocLite("GenomicFeatures")
I received the following error messages (in addition to several warning messages)
ERROR: configuration failed for package ‘RCurl’
* removing ‘/home/tim/R/i686-pc-linux-gnu-library/2.15/RCurl’
ERROR: dependencies ‘XML’, ‘RCurl’ are not available for package ‘rtracklayer’
* removing ‘/home/tim/R/i686-pc-linux-gnu-library/2.15/rtracklayer’
ERROR: dependencies ‘XML’, ‘RCurl’ are not available for package ‘biomaRt’
* removing ‘/home/tim/R/i686-pc-linux-gnu-library/2.15/biomaRt’
ERROR: dependencies ‘rtracklayer’, ‘biomaRt’, ‘RCurl’ are not available for package ‘GenomicFeatures’
* removing ‘/home/tim/R/i686-pc-linux-gnu-library/2.15/GenomicFeatures’
So some problem with the dependencies I guess, but it seems strange that they would be automatically installed prior to GF. I am using version 2.15.0. Any clue as to what the problem might be? I'd be happy to provide more info as needed. Thanks.
Martin Morgan has a solution that I believe works in the comments. I'll elaborate on that a little bit.
The error messages are telling you that you need the RCurl and XML packages installed. Both of these packages require that your system has certain development packages on them. You appear to be running Linux. If you're using a Debian based system (Debian, Ubuntu, Mint, ...) then for RCurl to install you need to install libcurl4-openssl-dev and for XML to install you need to install libxml2-dev. You can accomplish this by relatively easily on the command line by typing
sudo apt-get install libcurl4-openssl-dev libxml2-dev
That should install the required packages and any dependencies. Then you should be able to install the RCurl and XML packages from within R.
install.packages("RCurl")
install.packages("XML")
At this point you have the required dependencies and should be able to install GenomicFeatures from Bioconductor.
source("http://bioconductor.org/biocLite.R")
biocLite("GenomicFeatures")
Just a note for those using Windows - getting RCurl and XML isn't necessarily easy, however, Dr. Brian Ripley provides binaries for these packages at his website and you can download them from there quite easily. Initially when I saw there was issues with RCurl and XML I thought it must be a windows user until I looked at the actual errors and realized it was a Linux user.

Resources