Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Modern R Programming Cookbook

You're reading from   Modern R Programming Cookbook Recipes to simplify your statistical applications

Arrow left icon
Product type Paperback
Published in Oct 2017
Publisher Packt
ISBN-13 9781787129054
Length 236 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Jaynal Abedin Jaynal Abedin
Author Profile Icon Jaynal Abedin
Jaynal Abedin
Arrow right icon
View More author details
Toc

Table of Contents (10) Chapters Close

Preface 1. Installing and Configuring R and its Libraries FREE CHAPTER 2. Data Structures in R 3. Writing Customized Functions 4. Conditional and Iterative Operations 5. R Objects and Classes 6. Querying, Filtering, and Summarizing 7. R for Text Processing 8. R and Databases 9. Parallel Processing in R

Installing a specific version of R library

Open source software is being updated by the maintainers and new features are being added to the existing ones. Sometimes, a task is dependent on a specific version of a library. In this recipe, you will see how to install a specific version of a library and how to check the version of an installed library.

Getting ready

To install a specific version of an R library, there is another facility available. The necessary functions are bound into the versions library to do this job. You need to install versions before using the function within it. To get ready, you have to run the following command:

    install.packages("versions")

How to do it…

Take a look at the following steps:

  1. If you want to check which version of ggplot2 has been installed onto your computer, you can run the following command:
        library(versions)
installed.versions("ggplot2")

The preceding command will show the following output on the console screen:

        > installed.versions("ggplot2")
Checking package in 'C:/rPackages'
(as 'lib' is unspecified)
[1] "2.2.0"
>
  1. Now, to install the required version of any library, you first need to know the version number and how that has been written in the library documentation. Then, use that version number as follows:
      install.versions("ggplot2", versions = "2.2.0")

How it works…

Whenever you call the installed.versions() function, it looks at the DESCRIPTION file of that library and extracts the version number and displays it on the console.

Alternatively, whenever you call install.versions() to install the specified version of a library, it checks the date of that version and runs the install.dates() function internally to download the appropriate version onto the computer.

You have been reading a chapter from
Modern R Programming Cookbook
Published in: Oct 2017
Publisher: Packt
ISBN-13: 9781787129054
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image