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
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Statistical Application Development with R and Python

You're reading from   Statistical Application Development with R and Python Develop applications using data processing, statistical models, and CART

Arrow left icon
Product type Paperback
Published in Aug 2017
Publisher
ISBN-13 9781788621199
Length 432 pages
Edition 2nd Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Prabhanjan Narayanachar Tattar Prabhanjan Narayanachar Tattar
Author Profile Icon Prabhanjan Narayanachar Tattar
Prabhanjan Narayanachar Tattar
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Data Characteristics FREE CHAPTER 2. Import/Export Data 3. Data Visualization 4. Exploratory Analysis 5. Statistical Inference 6. Linear Regression Analysis 7. Logistic Regression Model 8. Regression Models with Regularization 9. Classification and Regression Trees 10. CART and Beyond Index

Using R packages

The CRAN repository hosts 10,969 packages as of July 2, 2017. The packages are written and maintained by statisticians, engineers, biologists, and others. The reasons are varied and the resourcefulness is very rich and it reduces the need of writing exhaustive and new functions and programs from scratch. These additional packages can be obtained from https://cran.r-project.org/web/packages/. The user can click on https://cran.rproject.org/web/packages/available_packages_by_date.html, which will direct you to a new web package. Let us illustrate the installation of an R package named gdata:

  • We now wish to install the gdata package. There are multiple ways of completing this task:
    1. Clicking on the gdata label leads to the web page: https://cran.r-project.org/web/packages/gdata/index.html.
    2. In this HTML file, we can find a lot of information about the package through Version, Depends, Imports, Published, Author, Maintainer, License, System Requirements, Installation, and CRAN checks.
    3. Furthermore, the download options may be chosen from the package source, macOS X binary, and Windows binary, depending on whether the user’s OS is Unix, macOS, or Windows respectively.
    4. Finally, a package may require other packages as a prerequisite, and it may itself be a prerequisite to other packages.

    This information is provided in Reverse dependencies, Reverse depends, Reverse imports, and Reverse suggests.

  • Suppose that the user has Windows OS. There are two ways to install the gdata package:
    1. Start R, as explained earlier. At the console, execute the code install.packages("gdata”).
    2. A CRAN mirror window will pop-up, asking the user to select one of the available mirrors.
    3. Select one of the mirrors from the list. You may need to scroll down to locate your favorite mirror, and then hit the Ok button.
    4. A default setting is dependencies=TRUE, which will then download and install all the other required packages.
    5. Unless there are some violations, such as the dependency requirement of the R version being at least 2.3 in this case, the packages would be installed successfully.
  • A second way of installing the gdata package is as follows:
    1. At the gdata web page, click on the following link: gdata_2.18.0.zip.
    2. This action will then attempt to download the package through the File download window.
    3. Choose the option Save and specify the path where you wish to download the package.
    4. In my case, I have chosen the C:\Users\author\Downloads directory.
    5. Now go to the R windows. In the menu ribbon, we have seven options in File, Edit, View, Misc, Packages, Windows, and Help.
    6. Yes, your guess is correct and you would have wisely selected Packages from the menu.
    7. Now, select the last option of Packages in Install Package(s) from local zip files and direct it to the path where you have downloaded the ZIP file.
    8. Select the gdata_2.18.0 file and R will do the required remaining part of installing the package.

The one drawback of doing this process manually is that if there are dependencies, the user needs to ensure that all such packages have been installed before embarking on this second task of installing the R packages. However, despite this problem, it is quite useful to know this technique, as we may not be connected to the internet all the time, and we can install the packages when it is convenient.

RSADBE – the books R package

This book uses lot of datasets from the web, statistical text books, and so on. The file format of the datasets have been varied and thus to help the reader, we have put all the datasets used in the book in an R package, RSADBE, which is the abbreviation of this book’s title. This package will be available from the CRAN website as well as this book’s web page. Thus, whenever you are asked to run data(xyz), the dataset xyz will be available either in the RSADBE package or datasets package of R.

The book also uses many of the packages available on CRAN. The following table gives the list of packages and the reader is advised to ensure that these packages are installed before you begin reading the chapter. That is, the reader needs to ensure that, as an example, install.packages(c("qcc”,”ggplot2”)) is run in the R session before proceeding with Chapter 3, Data Visualization.

Chapter number

Packages required

2

foreign, RMySQL

3

qcc, ggplot2

4

LearnEDA, aplpack

5

stats4, PASWR, PairedData

6

faraway

7

pscl, ROCR

8

ridge, DAAG

9

rpart, rattle

10

ipred, randomForest

You have been reading a chapter from
Statistical Application Development with R and Python - Second Edition
Published in: Aug 2017
Publisher:
ISBN-13: 9781788621199
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