4

I was trying to install a package called ei from this link . With GCC, r-base-dev and some other R package dependencies installed, it works perfect in my Ubuntu Linux system.

Now I am trying to install the same in Windows 7 environment. So far my setup is as follows,

  1. R installed in home folder (c:\Users\username\R-2.12.1\R. It is set to run as administrator, and the R folder is writable.
  2. My working directory is (c:\Users\username\Documents)
  3. Rtool is installed in (c:\Rtools)

Having this setup,

  1. I tried to install it by the command, install.packages("ei",repos="http://r.iq.harvard.edu"). This command gives me the following error message.

Installing package(s) into ‘C:\Users\username\Documents/R/win-library/2.12’ (as ‘lib’ is unspecified) Warning message: In getDependencies(pkgs, dependencies, available, lib) : package ‘ei’ is not available

After that I have decided to have a try to install it from a local zip file, so I proceeded in the following way,

  1. I have downloaded the package ei_0.938.tar.gz, untar it and make a zip file from that. I placed it into my work directory.
  2. I opened the terminal (Run > cmd), went to the work directory and tried to run the command R COM INSTALL ei

It shows me the following error message,

C:\Users\username\Documents>R COM INSTALL ei 'R' is not recognized as an internal or external command, operable program or batch file.

I am not sure what should I do now. Is there anyone to help?

Note: I can install packages from CRAN repos.

_ RB

small_lebowski
  • 701
  • 7
  • 23

1 Answers1

6

The second error sounds like you need to add R to your environment path. Here is what I have in my path for R, you may need to modify: C:\Program Files\R\R-2.12.0\bin\x64

Here's a blog outlining how to set your path variables.

I also had to reduce my User Account Control Settings before I could install R packages, but that may have been more to do with my machine and the network configs set by my IT department.

Roman Luštrik
  • 69,533
  • 24
  • 154
  • 197
Chase
  • 67,710
  • 18
  • 144
  • 161
  • Thanks for this interesting point. In my case, AFAIS, my path should be like this C:\Users\username\R\R-2.12.0\bin\i386. I have added that into the path but no result :( – small_lebowski Jan 19 '11 at 21:52
  • having your tips, i did a little bit googling and found this link - http://robjhyndman.com/researchtips/building-r-packages-for-windows/. I added Rtools into the path, but still no success. – small_lebowski Jan 19 '11 at 21:59
  • @user - what happens when you just type "R" into the DOS prompt? You should get the same text that you get when you start R through the GUI..."R version 2.12.0..." That will confirm if you have R correctly in your path. If so, then you can move onto installing a package from source through the DOS prompt. – Chase Jan 19 '11 at 22:19
  • If I open a cmd prompt and write R and enter then - 'R' is not recognized as an internal or external command, operable program or batch file. But when I write R in the 'search program and files field' in the start menu it opens R. – small_lebowski Jan 19 '11 at 22:25
  • Try the documentation, there are manuals that explain exactly what needs to be done to install from source in Windows. – mdsumner Jan 19 '11 at 22:32
  • funny thing is i am manually entering the path by following the way you told me. but when i write 'path' in the command prompt it is not showing that newly R path. This is the reason the R command is not recognized. wondering how to have the same output in the dos prompt. – small_lebowski Jan 19 '11 at 22:37
  • @user - your last comment indicates that R is not added properly to your path. I'd take another look at it. Once you get that figured out, see [this post](http://stackoverflow.com/questions/4739837/how-do-i-install-an-r-package-from-source-on-windows) – Chase Jan 19 '11 at 22:44
  • big shame! i need to get used to windows OS again. what i need was to close the command prompt window and start that again. now R command works. thanks a lot chase for your time. one further question, i have the tar.gz file for the package. is it enough to untar it zip the folder and run the R CMD INSTALL ei command? I did so and it says invalid package. – small_lebowski Jan 19 '11 at 22:59
  • problem solved! i should give R CMD INSTALL ei_0.938.tar.gz command. Thanks a lot again Chase! – small_lebowski Jan 19 '11 at 23:09
  • @Haseeb - glad you got it working. It is a common SO courtesy to vote up (once you have enough rep) and to "accept" the answers that most directly helped solve your problem. It not only helps to "build the community" but also serves as a good reference for future readers to know which answers may be worth reviewing first. Cheers! -Chase – Chase Jan 20 '11 at 22:46
  • actually i tried to vote it up, but i am 4 rep short of doing that :(. Thanks anyway. – small_lebowski Jan 21 '11 at 11:21