0

RStudio is not letting me install any new packages. As an example, I attempted to install "rio" today and got the following message:

install.packages("rio")
Installing package into ‘C:/Users/kjl5444/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
Warning in install.packages :
  dependency ‘openxlsx’ is not available
  There is a binary version available but the source version is later:
    binary source needs_compilation
rio  0.4.0  0.5.5             FALSE
installing the source package ‘rio’
trying URL 'https://cran.rstudio.com/src/contrib/rio_0.5.5.tar.gz'
Content type 'application/x-gzip' length 390824 bytes (381 KB)
downloaded 381 KB
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
Warning in install.packages :
  running command '"C:/Program Files/R/R-32~1.2/bin/x64/R" CMD INSTALL -l "C:\Users\kjl5444\Documents\R\win-library\3.2" C:\Users\kjl5444\AppData\Local\Temp\RtmpaQwlLL/downloaded_packages/rio_0.5.5.tar.gz' had status 1
Warning in install.packages :
  installation of package ‘rio’ had non-zero exit status
The downloaded source packages are in
    ‘C:\Users\kjl5444\AppData\Local\Temp\RtmpaQwlLL\downloaded_packages’
> library(rio)
Error in library(rio) : there is no package called ‘rio’

Any help on deciphering and fixing this error?

Phil
  • 7,287
  • 3
  • 36
  • 66
  • Maybe you changed the default working directory. In RStudio/Tools/Global Options under default directory do you see a single `~` or perhaps something like `C:\ `? The error message seems to suggest that Windows thinks that RStudio is requesting a program named `Program` be run in the `C:\` directory rather than the intended install command in what should be R's working directory. – John Coleman Nov 16 '17 at 15:35
  • If you are on a windows system, you should install R and RStudio to C:/ not the default C:/Programme/ – Christoph Nov 16 '17 at 15:45
  • @Christoph My R is in C:/Program Files/R and I have never had this problem. This is the default directory which the Windows installer for R uses. – John Coleman Nov 16 '17 at 15:52
  • @JohnColeman it was just an idea, see e.g. [here](https://magesblog.com/post/2012-04-26-installing-r-packages-without-admin/) – Christoph Nov 16 '17 at 15:56
  • @Christoph This is one of those questions where you can do little but guess as to the problem. Your suggestion might be relevant, but the error message seems like it isn't a permission problem (which the blog post that you linked to discusses). – John Coleman Nov 16 '17 at 16:01
  • @JohnColeman Default working directory has the single ~ – K. Lesciotto Nov 16 '17 at 19:25
  • @K.Lesciotto Then I have no idea. Perhaps you could reinstall RStudio (and perhaps R as well). If this didn't happen in the past but happens now then some setting in RStudio or perhaps some registry entry has been modified in a way that might be hard to track down. A reinstall will probably make the problem go away (while leaving the source of the problem a mystery). – John Coleman Nov 16 '17 at 20:05

1 Answers1

0

While trying to install the rio package in Microsoft windows. I faced an error. In order to resolve that issue, I googled and came to this page.

I know this post is a bit old post but thought to share it for those who face a similar issue in installing this package.

Similar to this post: Error: "there is no package called ..." and trying to use install.packages to solve it

I could only install rio when I used the command: install.packages('rio', dependencies = TRUE, repos='http://cran.rstudio.com/')

Perhaps it can help you successfully install the required packages as it ensures that dependencies are also installed along with the required package.

Sandy
  • 1,100
  • 10
  • 18