Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R Newbie Confused about Install Packages

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!

like image 575
Btibert3 Avatar asked Jan 03 '11 20:01

Btibert3


People also ask

Does R require any packages to be installed?

Many R scripts open with calls to library() and require() to load the packages they need in order to execute. If you open an R script that references packages that you don't have installed, RStudio will now offer to install all the needed packages in a single click. No more typing install.

Why is my R not installing packages?

Changing the configuration in R Studio to solve install packages issue. Go To Tools -> Global option -> Packages. Then uncheck the option “Use secure download method for HTTP”. For other RStudio issues refer to official Troubleshooting Guide here.

Why do we need to install packages in R?

R packages are collections of functions and data sets developed by the community. They increase the power of R by improving existing base R functionalities, or by adding new ones. For example, if you are usually working with data frames, probably you will have heard about dplyr or data.


2 Answers

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.

like image 186
Joshua Ulrich Avatar answered Oct 13 '22 23:10

Joshua Ulrich


You are probably missing the components to build packages under Windows:

http://www.murdoch-sutherland.com/Rtools/

like image 21
IRTFM Avatar answered Oct 13 '22 23:10

IRTFM