Ari B. Friedman
Ari B. Friedman

Reputation: 72731

How to force older packages to install on newer versions of R?

I cannot install proj4string into my current version of R (2.15.1):

Warning message:
package ‘proj4string’ is not available (for R version 2.15.1) 

I assume this is because 2.15.1 is fairly new and the package just hasn't been updated. Is there a general mechanism for forcing R to install an older version of a binary package (realizing that there may be bugs that result)?

Upvotes: 6

Views: 16395

Answers (3)

Benjamin Ziepert
Benjamin Ziepert

Reputation: 1754

You can use install_version from the package devtools to install a specific package version.

To find the package version:

  1. Search for the CRAN page of the package. E.g. for ggmap it is https://CRAN.R-project.org/package=ggmap

  2. Check the archived packages. See heading "Downloads" and "Old Sources:"

Example code for package ggmap

devtools::install_version(  
  "ggmap",
  version = "2.6",
  repos = "http://cran.us.r-project.org"  
)

Upvotes: 1

BioProgram
BioProgram

Reputation: 704

sorry to bump this post again, but i had the same problem . then i found that I can use the following lines for the package:

install.packages("devtools")
devtools::install_github("slowkow/ggrepel")

replaced "slowkow/ggrepel" by the package and github repo.

What i noticed that many packages on github will have details to that. Hope that helps.

Upvotes: 0

Ben Bolker
Ben Bolker

Reputation: 226047

(upgraded from a comment)

Download the relevant package (zip, tarball, whatever) from the archives and install it locally, e.g.

install.packages("proj4string_x.y.z.zip",repos=NULL)

(this is not literal: x.y.z represents the package version)

Upvotes: 12

Related Questions