Back

Explore Courses Blog Tutorials Interview Questions
0 votes
10 views
in R Programming by (7.3k points)
edited by

I am trying to use Rpy2 and ggplot2 but I get an error. After some searching for the error online, I found that the error occurs because there are changes in the ggplot2 package that are not yet reflected in Rpy2.

So I now need to install an older version of ggplot2. Here is pseudo-code for what I want:

install.packages("ggplot2", version='0.9.1')

But install.packages does not have a version argument. How do I do it?

1 Answer

0 votes
by
edited by

To install an older version of a package from source, do the following:

PackageUrl <- "http://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_0.9.1.tar.gz"

 install.packages(PackageUrl, repos=NULL, type="source")

In some cases, you need to install Rtools so that you can compile the archived packages locally.

You can also use the devtools package to install an older version of a package as follows:

 require(devtools) 

 install_version("ggplot2", version = "0.9.1", repos = "http://cran.us.r-project.org") 

You can also use the remotes package as follows:

library(remotes)

install_version("package_name", "0.1.1")

Browse Categories

...