0

I'm having problems installing the package car in R.

There are previous posts on the topic, including this one and this other one.

I have followed the suggestions I've come across so far without success. I am using R Version 3.2.2. and RStudio.

This is the message I get:

install.packages("car")
Installing package into ‘C:/Users/.../Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/car_2.1-3.zip'
Content type 'application/zip' length 1447213 bytes (1.4 MB)
downloaded 1.4 MB

package ‘car’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\...\AppData\Local\Temp\Rtmpc3xr5i\downloaded_packages

If I check I get,

?car
No documentation for ‘car’ in specified packages and libraries:
you could try ‘??car’

I tried installing it from R with Install packages from local zip drives, and looking for the zip in C:\Users\...\AppData\Local\Temp\Rtmpc3xr5i\downloaded_packages, but this is the result:

library(car)
Error in library.dynam(lib, package, package.lib) : 
  DLL ‘SparseM’ not found: maybe not installed for this architecture?
In addition: Warning message:
package ‘car’ was built under R version 3.2.5 
Error: package or namespace load failed for ‘car’

I did try installing SparseM even before posting the OP without success:

> install.packages("SparseM")
Installing package into ‘C:/Users/.../Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/SparseM_1.7.zip'
Content type 'application/zip' length 795531 bytes (776 KB)
downloaded 776 KB

package ‘SparseM’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\...\AppData\Local\Temp\Rtmpc3xr5i\downloaded_packages
> ?SparseM
No documentation for ‘SparseM’ in specified packages and libraries:
you could try ‘??SparseM’

Follow up:

After a comment regarding R version 3.2.3 I thought it would be an easy fix to just download this version, install, and erase 3.2.2. The problem then is that RStudio did not seem to work. I un-installed and re-installed R-studio, and now I get this when opening R studio:

enter image description here

Community
  • 1
  • 1
Antoni Parellada
  • 4,253
  • 6
  • 49
  • 114
  • 1
    are you able to upgrade your r version, as some of the import packages depend on later r versions – user20650 Sep 02 '16 at 23:06
  • Your error message is possibly incomplete. Was there a message before the `car` install results that mentioned something about `SparseM`? When I install `car`, I get an explicit dependency on `SparseM`, so if it isn't available for your arch/Rversion, it will raise an error. (Perhaps try `install.packages("SparseM")` and edit your question with the results.) – r2evans Sep 02 '16 at 23:16
  • @r2evans; i think issues will persist as it imports [pkbrtest](https://cran.r-project.org/web/packages/pbkrtest/index.html) which needs R >3.2.3 – user20650 Sep 02 '16 at 23:30
  • `pkbrtest` is not included anywhere in the `DESCRIPTION`, but now I see that it did install. You may be right, I was just feeding off the `'SparseM' not found` (which is still supported for R-3.2.2). Perhaps `SparseM` was a momentary failed install, where another attempt will work just fine (that's happened to me). Won't know until OP comes back with edits/comments. – r2evans Sep 02 '16 at 23:34
  • @r2evans, pkbrtest is in the imports section of the DESCRIPTION file. But your right installing `SparseM` would normally be the first suggestion (although they do say they tries the suggestion in the links ie `install.packages(... dependencies=TRUE)` ) . But [pkbrtest is a known issue](http://stackoverflow.com/questions/35207624/package-pbkrtest-is-not-available-for-r-version-3-2-2) : knew i'd seen it somewhere ;) – user20650 Sep 02 '16 at 23:40
  • 1
    I can't read, apparently. Thanks. (Actually, it was a dyslexic `grep`, easy to do with a name like that.) – r2evans Sep 02 '16 at 23:40
  • ha is my friend with that one – user20650 Sep 02 '16 at 23:41
  • The message "No documentation" is normal, and does nothing to indicate if a package is installed (try `?somethingnotinstalled`). One method is `packageVersion("SparseM")`, but a better follow-on: now that `SparseM` is installed, have you retried `library(car)`? If @user20650 is correct, you'll likely get an error about `pkbrtest`. – r2evans Sep 02 '16 at 23:54
  • Try an reinstall rstudio - it also depends on the rversion – user20650 Sep 03 '16 at 00:27
  • @user20650 I did a couple of times without success... – Antoni Parellada Sep 03 '16 at 00:29
  • okay, so you are on windows. So just to check can you access R using the default windows rgui? – user20650 Sep 03 '16 at 00:33
  • Yes, I can access R. – Antoni Parellada Sep 03 '16 at 00:35
  • v 3.3.1 i assume. if so, i can only suggest going into control panel >uninstall programs > rstudio, and then trying to install rstudio again. – user20650 Sep 03 '16 at 00:37
  • install the [most up to date r version from cran] (https://cran.r-project.org/bin/windows/base/). Then reinstall rstudio. – user20650 Sep 03 '16 at 00:40
  • Which version is the latest? – Antoni Parellada Sep 03 '16 at 00:41
  • see link ^^ ... – user20650 Sep 03 '16 at 00:42

1 Answers1

4

Without knowing what version of the car package you're using, it's hard to know exactly what the source of the problem is. It seems likely, however, that you haven't installed the proper version of the pbkrtest, on which the Rcmdr package depends.

Is there a compelling reason not to upgrade everything to their current versions, including R, all packages, and RStudio?

Best, John

John Fox
  • 284
  • 1
  • 3
  • I tried doing all this. Right now the problems that all this have caused on my laptop make the package car a remote thought... No R... No RStudio... – Antoni Parellada Sep 03 '16 at 02:02
  • @Toni; you said in the comments above you had R - accessed by the rgui. It seemed you upgraded from 3.2.2 to 3.2.3, however, it is definitely best to upgrade to the current stable r version (link above). Can you do that and then respond that you can access r v3.3.1 via the rgui (ignoring your issue with car and rstudio just now) – user20650 Sep 03 '16 at 02:32
  • @user20650 Thank you very much for all your help. I would need a full page to describe what I have done to go back to baseline. I'll comb through all your comments later or tomorrow. Thanks, again! – Antoni Parellada Sep 03 '16 at 02:38