icudt error while installing stringi library in R - r

I'm writing this because it took me several days to come to this result.
Bottom line: The stringi library version 1.1.3 (released March 2017) might have issues involving icudt. You can install stringi 1.1.2 using the following commands:
packageurl <- "https://cran.r-project.org/src/contrib/Archive/stringi/stringi_1.1.2.tar.gz"
install.packages(packageurl, repos=NULL, type="source")
I put this together from some RStudio documentation on how to install an older package.
Background:
I was trying to install the forecast library in R. Originally, I was using R 3.1.2. I also installed R 3.3.3 and tried to install stringi it. I'm running CentOS 6.7 and don't have a choice to upgrade.
Forecast failed to install due to issues installing stringi. The stringi library failed to install due to errors downloading ICU data library (icudt)
It looks like stringi 1.1.3 added download/build logic regarding icudt, and upcoming version 1.1.4 has corrections to this logic (as of date 2017-04-02).
I went to the ICU project site: and downloaded/installed the ICU library that appeared to be specified in the error messages below:
checking whether we may compile src/icu55/common/umapfile.c... yes
checking whether we may compile src/icu55/common/putil.cpp... yes
checking whether we can fetch icudt... WARNING: ignoring environment value of R_HOME
downloading ICU data library (icudt)
output path: icu55/data/icudt55l.zip
Error in stri_download_icudt("icu55/data") :
could not find function "dir.exists"
Calls: identical -> stri_download_icudt
Execution halted
*** icudt could not be downloaded. stopping.
ERROR: configuration failed for package ‘stringi’
Searches online for icu55, icudt55l.zip, or any procedure that followed to get past this error didn't turn up a procedure that worked. I downloaded, built, and installed ICU 55.1 and also ICU 58.2. I also updated gcc and g++. The CRAN repository install notes for stringi 1.1.3 don't currently give a straightforward set of instructions to successfully install stringi when I have a working internet connection.
I started by asking this as a question and then found my answer. I'll post it anyways. I had added several links but needed to remove them because I don't have enough cred to get away with them.

This has nothing to do with ICU. This is a bug in stringi, which I have already fixed in version 1.1.5 (now on CRAN). The dir.exists() function is specific to R ≥ 3.2.0 - I wasn't aware of that. Sorry for inconvenience.

The stringi library version 1.1.3 (released March 2017) might have issues involving icudt. You can install stringi 1.1.2 using the following commands:
packageurl <- "https://cran.r-project.org/src/contrib/Archive/stringi/stringi_1.1.2.tar.gz"
install.packages(packageurl, repos=NULL, type="source")

Related

Arte there any free alternatives to packages "translate" and "translateR"? [duplicate]

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 (for example, see this post (Edit: Link is now dead)).
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?
To install an older version of a package from source (within R):
packageurl <- "http://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_0.9.1.tar.gz"
install.packages(packageurl, repos=NULL, type="source")
If this doesn't work for you and you're on Windows, the reason is probably the lack of an appropriate tool chain for building/compiling packages. Normally you would install a pre-compiled binary from CRAN but they only archive package sources, not binaries.[1] This means you need to install Rtools so that you can compile everything locally. (Note: Rtools is not an R package.)
#shadow's answer below also makes the case that you can use devtools::install_version(). That's also a good idea, but is also subject to needing Rtools on Windows.
As of September 18, 2015, a new package versions has appeared on CRAN. This relies on the Revolution Analytics MRAN server to install packages for specific versions or dates:
# install yesterday's version of checkpoint, by date
install.dates('checkpoint', Sys.Date() - 1)
# install earlier versions of checkpoint and devtools
install.versions(c('checkpoint', 'devtools'), c('0.3.3', '1.6.1'))
That has the advantage of not requiring Rtools to install binary packages on Windows, but only works going back to 2014-09-17 (when MRAN was launched).
To install an older version from the command line (outside of R):
You can also install a package by using R CMD INSTALL on the command line (Terminal, Command Prompt, etc.) once you have the package source ("tarball") locally on your machine, for example using wget (if you have it):
wget http://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_0.9.1.tar.gz
or, if you're on Windows, an equivalent using PowerShell would be:
(new-object System.Net.WebClient).DownloadFile("http://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_0.9.1.tar.gz", "./ggplot2_0.9.1.tar.gz")
or you can just download the source from the CRAN archive via your web browser.
To install from the local file, you can just do:
R CMD INSTALL ggplot2_0.9.1.tar.gz
That should work on any platform (with the same caveat - as above - about needing a tool chain for building packages).
[1]This is no longer entirely true. From March 2016, CRAN has started hosting a "CRAN Archive" server that contains Windows and Mac binaries for very old versions of R (> 5 years old). You can now install directly from this server using install.packages(). See new R FAQ 7.44 for some details.
The remotes package offers an install_version function that can do this directly.
require(remotes)
install_version("ggplot2", version = "0.9.1", repos = "http://cran.us.r-project.org")
Previously, this answer pointed to the devtools package, which also re-exports the install_version function. Thanks #MichaelChirico for pointing out that the remotes package is preferable.
You can download your appropriate version from the link below as a zip file.
http://cran.r-project.org/src/contrib/Archive/ggplot2/
In R Studio:
Tools >> Install packages >> Install from: (select drop down)
Package Archive File(.zip, .tar.gz).
Choose your newly-downloaded-package-zip-file and install the package
Pure install.packages method
See this thread on the r-devel mailing list. In reply to Kurt Wheeler, Kurt Hornik reveals an undocumented feature of the CRAN website to specify the specific version of a package.
This method will work as long as you have all required dependencies already installed:
package = "https://cran.r-project.org/package=svglite&version=1.2.1"
utils::install.packages(pkgs = package, repos = NULL)
Note the URL structure above. This addresses the issue that CRAN has a different URL structure for the latest version than for archived versions:
# Latest version (not available at Archive/svglite)
https://cran.r-project.org/src/contrib/svglite_1.2.1.tar.gz
# Archived version
https://cran.r-project.org/src/contrib/Archive/svglite/svglite_1.2.0.tar.gz
remotes::install_version method
Another option is to use the remotes::install_version function. However, you will need to install the remotes package.
Using install.packages as described in another answer does not work for me.
The best alternative I found is to use function install_url from package devtools.
Another possibility that I have not explored further:
Download the older .tar.gz source file from the package archives.
Follow the steps documented on http://rtm.wustl.edu/writings/htrtargz.pdf to install it locally.
There is a versions package that simplifies this task considerably, for package versions released since 2014-09-17. It uses snapshots of the MRAN server at Revolution Analytics to:
show release dates and MRAN availability of any CRAN package (available.versions),
install specified versions of one or more packages(install.versions), or
install package versions available as of any specified date (install.dates). It does the installation from the MRAN server via the standard install.packages function, so available binary versions can be installed instead of having to compile from source, and package dependencies as of the specified date can be included.
There might of course be compatibility issues with combinations of package versions and R versions. For running different R versions, see for example this page.
Found a good solution, which worked for me (the details are at the link).
Command in "repmis" library:
# Install old versions of the e1071 and gtools packages.
# Create vectors of the package names and versions to install
# Note the names and version numbers must be in the same order
Names <- c("e1071", "gtools")
Vers <- c("1.6", "2.6.1")
# Install old package versions into the default library
InstallOldPackages(pkgs = Names, versions = Vers)
Another option is the {groundhog} package. It helps install an older package Version from CRAN by specifying a date. This is especially helpful when one doesn't remember the specific package version, but rather the time the script was still working. In case of {ggplot2} version 0.9.1 was loaded on CRAN in May 2012 so we can take a date from June.
library("groundhog")
groundhog.library("ggplot2", "2012-06-01")

Saving an R session [duplicate]

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 (for example, see this post (Edit: Link is now dead)).
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?
To install an older version of a package from source (within R):
packageurl <- "http://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_0.9.1.tar.gz"
install.packages(packageurl, repos=NULL, type="source")
If this doesn't work for you and you're on Windows, the reason is probably the lack of an appropriate tool chain for building/compiling packages. Normally you would install a pre-compiled binary from CRAN but they only archive package sources, not binaries.[1] This means you need to install Rtools so that you can compile everything locally. (Note: Rtools is not an R package.)
#shadow's answer below also makes the case that you can use devtools::install_version(). That's also a good idea, but is also subject to needing Rtools on Windows.
As of September 18, 2015, a new package versions has appeared on CRAN. This relies on the Revolution Analytics MRAN server to install packages for specific versions or dates:
# install yesterday's version of checkpoint, by date
install.dates('checkpoint', Sys.Date() - 1)
# install earlier versions of checkpoint and devtools
install.versions(c('checkpoint', 'devtools'), c('0.3.3', '1.6.1'))
That has the advantage of not requiring Rtools to install binary packages on Windows, but only works going back to 2014-09-17 (when MRAN was launched).
To install an older version from the command line (outside of R):
You can also install a package by using R CMD INSTALL on the command line (Terminal, Command Prompt, etc.) once you have the package source ("tarball") locally on your machine, for example using wget (if you have it):
wget http://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_0.9.1.tar.gz
or, if you're on Windows, an equivalent using PowerShell would be:
(new-object System.Net.WebClient).DownloadFile("http://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_0.9.1.tar.gz", "./ggplot2_0.9.1.tar.gz")
or you can just download the source from the CRAN archive via your web browser.
To install from the local file, you can just do:
R CMD INSTALL ggplot2_0.9.1.tar.gz
That should work on any platform (with the same caveat - as above - about needing a tool chain for building packages).
[1]This is no longer entirely true. From March 2016, CRAN has started hosting a "CRAN Archive" server that contains Windows and Mac binaries for very old versions of R (> 5 years old). You can now install directly from this server using install.packages(). See new R FAQ 7.44 for some details.
The remotes package offers an install_version function that can do this directly.
require(remotes)
install_version("ggplot2", version = "0.9.1", repos = "http://cran.us.r-project.org")
Previously, this answer pointed to the devtools package, which also re-exports the install_version function. Thanks #MichaelChirico for pointing out that the remotes package is preferable.
You can download your appropriate version from the link below as a zip file.
http://cran.r-project.org/src/contrib/Archive/ggplot2/
In R Studio:
Tools >> Install packages >> Install from: (select drop down)
Package Archive File(.zip, .tar.gz).
Choose your newly-downloaded-package-zip-file and install the package
Pure install.packages method
See this thread on the r-devel mailing list. In reply to Kurt Wheeler, Kurt Hornik reveals an undocumented feature of the CRAN website to specify the specific version of a package.
This method will work as long as you have all required dependencies already installed:
package = "https://cran.r-project.org/package=svglite&version=1.2.1"
utils::install.packages(pkgs = package, repos = NULL)
Note the URL structure above. This addresses the issue that CRAN has a different URL structure for the latest version than for archived versions:
# Latest version (not available at Archive/svglite)
https://cran.r-project.org/src/contrib/svglite_1.2.1.tar.gz
# Archived version
https://cran.r-project.org/src/contrib/Archive/svglite/svglite_1.2.0.tar.gz
remotes::install_version method
Another option is to use the remotes::install_version function. However, you will need to install the remotes package.
Using install.packages as described in another answer does not work for me.
The best alternative I found is to use function install_url from package devtools.
Another possibility that I have not explored further:
Download the older .tar.gz source file from the package archives.
Follow the steps documented on http://rtm.wustl.edu/writings/htrtargz.pdf to install it locally.
There is a versions package that simplifies this task considerably, for package versions released since 2014-09-17. It uses snapshots of the MRAN server at Revolution Analytics to:
show release dates and MRAN availability of any CRAN package (available.versions),
install specified versions of one or more packages(install.versions), or
install package versions available as of any specified date (install.dates). It does the installation from the MRAN server via the standard install.packages function, so available binary versions can be installed instead of having to compile from source, and package dependencies as of the specified date can be included.
There might of course be compatibility issues with combinations of package versions and R versions. For running different R versions, see for example this page.
Found a good solution, which worked for me (the details are at the link).
Command in "repmis" library:
# Install old versions of the e1071 and gtools packages.
# Create vectors of the package names and versions to install
# Note the names and version numbers must be in the same order
Names <- c("e1071", "gtools")
Vers <- c("1.6", "2.6.1")
# Install old package versions into the default library
InstallOldPackages(pkgs = Names, versions = Vers)
Another option is the {groundhog} package. It helps install an older package Version from CRAN by specifying a date. This is especially helpful when one doesn't remember the specific package version, but rather the time the script was still working. In case of {ggplot2} version 0.9.1 was loaded on CRAN in May 2012 so we can take a date from June.
library("groundhog")
groundhog.library("ggplot2", "2012-06-01")

Install previous version of libraries in R [duplicate]

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 (for example, see this post (Edit: Link is now dead)).
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?
To install an older version of a package from source (within R):
packageurl <- "http://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_0.9.1.tar.gz"
install.packages(packageurl, repos=NULL, type="source")
If this doesn't work for you and you're on Windows, the reason is probably the lack of an appropriate tool chain for building/compiling packages. Normally you would install a pre-compiled binary from CRAN but they only archive package sources, not binaries.[1] This means you need to install Rtools so that you can compile everything locally. (Note: Rtools is not an R package.)
#shadow's answer below also makes the case that you can use devtools::install_version(). That's also a good idea, but is also subject to needing Rtools on Windows.
As of September 18, 2015, a new package versions has appeared on CRAN. This relies on the Revolution Analytics MRAN server to install packages for specific versions or dates:
# install yesterday's version of checkpoint, by date
install.dates('checkpoint', Sys.Date() - 1)
# install earlier versions of checkpoint and devtools
install.versions(c('checkpoint', 'devtools'), c('0.3.3', '1.6.1'))
That has the advantage of not requiring Rtools to install binary packages on Windows, but only works going back to 2014-09-17 (when MRAN was launched).
To install an older version from the command line (outside of R):
You can also install a package by using R CMD INSTALL on the command line (Terminal, Command Prompt, etc.) once you have the package source ("tarball") locally on your machine, for example using wget (if you have it):
wget http://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_0.9.1.tar.gz
or, if you're on Windows, an equivalent using PowerShell would be:
(new-object System.Net.WebClient).DownloadFile("http://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_0.9.1.tar.gz", "./ggplot2_0.9.1.tar.gz")
or you can just download the source from the CRAN archive via your web browser.
To install from the local file, you can just do:
R CMD INSTALL ggplot2_0.9.1.tar.gz
That should work on any platform (with the same caveat - as above - about needing a tool chain for building packages).
[1]This is no longer entirely true. From March 2016, CRAN has started hosting a "CRAN Archive" server that contains Windows and Mac binaries for very old versions of R (> 5 years old). You can now install directly from this server using install.packages(). See new R FAQ 7.44 for some details.
The remotes package offers an install_version function that can do this directly.
require(remotes)
install_version("ggplot2", version = "0.9.1", repos = "http://cran.us.r-project.org")
Previously, this answer pointed to the devtools package, which also re-exports the install_version function. Thanks #MichaelChirico for pointing out that the remotes package is preferable.
You can download your appropriate version from the link below as a zip file.
http://cran.r-project.org/src/contrib/Archive/ggplot2/
In R Studio:
Tools >> Install packages >> Install from: (select drop down)
Package Archive File(.zip, .tar.gz).
Choose your newly-downloaded-package-zip-file and install the package
Pure install.packages method
See this thread on the r-devel mailing list. In reply to Kurt Wheeler, Kurt Hornik reveals an undocumented feature of the CRAN website to specify the specific version of a package.
This method will work as long as you have all required dependencies already installed:
package = "https://cran.r-project.org/package=svglite&version=1.2.1"
utils::install.packages(pkgs = package, repos = NULL)
Note the URL structure above. This addresses the issue that CRAN has a different URL structure for the latest version than for archived versions:
# Latest version (not available at Archive/svglite)
https://cran.r-project.org/src/contrib/svglite_1.2.1.tar.gz
# Archived version
https://cran.r-project.org/src/contrib/Archive/svglite/svglite_1.2.0.tar.gz
remotes::install_version method
Another option is to use the remotes::install_version function. However, you will need to install the remotes package.
Using install.packages as described in another answer does not work for me.
The best alternative I found is to use function install_url from package devtools.
Another possibility that I have not explored further:
Download the older .tar.gz source file from the package archives.
Follow the steps documented on http://rtm.wustl.edu/writings/htrtargz.pdf to install it locally.
There is a versions package that simplifies this task considerably, for package versions released since 2014-09-17. It uses snapshots of the MRAN server at Revolution Analytics to:
show release dates and MRAN availability of any CRAN package (available.versions),
install specified versions of one or more packages(install.versions), or
install package versions available as of any specified date (install.dates). It does the installation from the MRAN server via the standard install.packages function, so available binary versions can be installed instead of having to compile from source, and package dependencies as of the specified date can be included.
There might of course be compatibility issues with combinations of package versions and R versions. For running different R versions, see for example this page.
Found a good solution, which worked for me (the details are at the link).
Command in "repmis" library:
# Install old versions of the e1071 and gtools packages.
# Create vectors of the package names and versions to install
# Note the names and version numbers must be in the same order
Names <- c("e1071", "gtools")
Vers <- c("1.6", "2.6.1")
# Install old package versions into the default library
InstallOldPackages(pkgs = Names, versions = Vers)
Another option is the {groundhog} package. It helps install an older package Version from CRAN by specifying a date. This is especially helpful when one doesn't remember the specific package version, but rather the time the script was still working. In case of {ggplot2} version 0.9.1 was loaded on CRAN in May 2012 so we can take a date from June.
library("groundhog")
groundhog.library("ggplot2", "2012-06-01")

Installing a Package Removed from CRAN

I am using the R programming language. I am trying to install the "Data Mining with R" (DMwR) package. However, when I visit the CRAN website for this package, it seems to be gone:
Package ‘DMwR’ was removed from the CRAN repository.
Formerly available versions can be obtained from the archive.
Archived on 2021-03-16 as check problems were not corrected despite reminders.
A summary of the most recent check results can be obtained from the check results archive.
I visited the Github page for this package
Then, I tried to install this package directly from Github:
> library(devtools)
Loading required package: usethis
Warning message:
package ‘usethis’ was built under R version 4.0.5
> install_github("Luis Torgo/DMwR")
Error: Failed to install 'unknown package' from GitHub:
JSON: EXPECTED value GOT <
But this also is not working. Can someone please show me how to install this package?
Besides installing from the CRAN mirror repo, another option is
remotes::install_version("DMwR", version="0.4.1")
for this method, you do have to look up the last version in the archive directory (would probably be scrapeable if you wanted to write the code)
as with remotes::install_github("cran/<package>"), you will be installing from source, which means that if the package or any of its dependencies have compiled components (in this case it doesn't appear so), you'll need to have development tools (compiler etc.) installed on your system
A quick word of caution:
this will work well if packages have been archived recently, and if the reason for archiving was because the CRAN maintainers are being fussy (that's their prerogative);
however, a package may have become incompatible with the rest of the current R ecosystem (R version, dependencies) since its last update - in which case you may find yourself in dependency hell trying to install it (or, worse, your results may be unreliable).
Had the same message on R 4.1.0
install.packages("DMwR")
Warning message:
package ‘DMwR’ is not available for this version of R
An option is also to create a checkpoint. According to the CRAN package website, it is archived on '2021-03-16'. So, we could use the checkpoint one day before that date
library(checkpoint)
checkpoint("2021-03-15")
install.packages("DMwR")
library(DMwR)
#Loading required package: lattice
#Loading required package: grid
#Registered S3 method overwritten by 'quantmod':
# method from
# as.zoo.data.frame zoo
The checkpoint can be deleted as well
delete_all_checkpoints()
You can install it from the CRAN github mirror (despite it being removed from CRAN), e.g.
library(devtools)
install_github("cran/DMwR")
That package was in support of a book published in 2010. The author published a second edition in 2017 and the current version of the support package is https://cran.r-project.org/web/packages/DMwR2/index.html
It does have currently CRAN-hosted source and binary packages, and doesn't need compilation, so it should be able to be installed with:
install.packages("DMwR2", dependencies=TRUE)
You can get the most recent version by following the directions at the Github site:
library(devtools) # You need to install this package!
install_github("ltorgo/DMwR2",ref="develop")
Those are much more likely to run properly with recent versions of R.

Installing older version of R package

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 (for example, see this post (Edit: Link is now dead)).
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?
To install an older version of a package from source (within R):
packageurl <- "http://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_0.9.1.tar.gz"
install.packages(packageurl, repos=NULL, type="source")
If this doesn't work for you and you're on Windows, the reason is probably the lack of an appropriate tool chain for building/compiling packages. Normally you would install a pre-compiled binary from CRAN but they only archive package sources, not binaries.[1] This means you need to install Rtools so that you can compile everything locally. (Note: Rtools is not an R package.)
#shadow's answer below also makes the case that you can use devtools::install_version(). That's also a good idea, but is also subject to needing Rtools on Windows.
As of September 18, 2015, a new package versions has appeared on CRAN. This relies on the Revolution Analytics MRAN server to install packages for specific versions or dates:
# install yesterday's version of checkpoint, by date
install.dates('checkpoint', Sys.Date() - 1)
# install earlier versions of checkpoint and devtools
install.versions(c('checkpoint', 'devtools'), c('0.3.3', '1.6.1'))
That has the advantage of not requiring Rtools to install binary packages on Windows, but only works going back to 2014-09-17 (when MRAN was launched).
To install an older version from the command line (outside of R):
You can also install a package by using R CMD INSTALL on the command line (Terminal, Command Prompt, etc.) once you have the package source ("tarball") locally on your machine, for example using wget (if you have it):
wget http://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_0.9.1.tar.gz
or, if you're on Windows, an equivalent using PowerShell would be:
(new-object System.Net.WebClient).DownloadFile("http://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_0.9.1.tar.gz", "./ggplot2_0.9.1.tar.gz")
or you can just download the source from the CRAN archive via your web browser.
To install from the local file, you can just do:
R CMD INSTALL ggplot2_0.9.1.tar.gz
That should work on any platform (with the same caveat - as above - about needing a tool chain for building packages).
[1]This is no longer entirely true. From March 2016, CRAN has started hosting a "CRAN Archive" server that contains Windows and Mac binaries for very old versions of R (> 5 years old). You can now install directly from this server using install.packages(). See new R FAQ 7.44 for some details.
The remotes package offers an install_version function that can do this directly.
require(remotes)
install_version("ggplot2", version = "0.9.1", repos = "http://cran.us.r-project.org")
Previously, this answer pointed to the devtools package, which also re-exports the install_version function. Thanks #MichaelChirico for pointing out that the remotes package is preferable.
You can download your appropriate version from the link below as a zip file.
http://cran.r-project.org/src/contrib/Archive/ggplot2/
In R Studio:
Tools >> Install packages >> Install from: (select drop down)
Package Archive File(.zip, .tar.gz).
Choose your newly-downloaded-package-zip-file and install the package
Pure install.packages method
See this thread on the r-devel mailing list. In reply to Kurt Wheeler, Kurt Hornik reveals an undocumented feature of the CRAN website to specify the specific version of a package.
This method will work as long as you have all required dependencies already installed:
package = "https://cran.r-project.org/package=svglite&version=1.2.1"
utils::install.packages(pkgs = package, repos = NULL)
Note the URL structure above. This addresses the issue that CRAN has a different URL structure for the latest version than for archived versions:
# Latest version (not available at Archive/svglite)
https://cran.r-project.org/src/contrib/svglite_1.2.1.tar.gz
# Archived version
https://cran.r-project.org/src/contrib/Archive/svglite/svglite_1.2.0.tar.gz
remotes::install_version method
Another option is to use the remotes::install_version function. However, you will need to install the remotes package.
Using install.packages as described in another answer does not work for me.
The best alternative I found is to use function install_url from package devtools.
Another possibility that I have not explored further:
Download the older .tar.gz source file from the package archives.
Follow the steps documented on http://rtm.wustl.edu/writings/htrtargz.pdf to install it locally.
There is a versions package that simplifies this task considerably, for package versions released since 2014-09-17. It uses snapshots of the MRAN server at Revolution Analytics to:
show release dates and MRAN availability of any CRAN package (available.versions),
install specified versions of one or more packages(install.versions), or
install package versions available as of any specified date (install.dates). It does the installation from the MRAN server via the standard install.packages function, so available binary versions can be installed instead of having to compile from source, and package dependencies as of the specified date can be included.
There might of course be compatibility issues with combinations of package versions and R versions. For running different R versions, see for example this page.
Found a good solution, which worked for me (the details are at the link).
Command in "repmis" library:
# Install old versions of the e1071 and gtools packages.
# Create vectors of the package names and versions to install
# Note the names and version numbers must be in the same order
Names <- c("e1071", "gtools")
Vers <- c("1.6", "2.6.1")
# Install old package versions into the default library
InstallOldPackages(pkgs = Names, versions = Vers)
Another option is the {groundhog} package. It helps install an older package Version from CRAN by specifying a date. This is especially helpful when one doesn't remember the specific package version, but rather the time the script was still working. In case of {ggplot2} version 0.9.1 was loaded on CRAN in May 2012 so we can take a date from June.
library("groundhog")
groundhog.library("ggplot2", "2012-06-01")

Resources