Modern R Programming Cookbook

Book description

Recipes for emerging developers in R programming and data scientists to simplify their R programming capabilities

About This Book

  • Develop strategies to speed up your R code

  • Tackle programming problems and explore both functional and object-oriented programming techniques

  • Learn how to address the core problems of programming in R with the most popular R packages for common tasks

  • Who This Book Is For

    This book is for developers who would like to enhance the R programming skills. Basic knowledge of R programming is assumed.

    What You Will Learn

  • Install R and its various IDE for a given platform along with installing libraries from different repositories and version control

  • Learn about basic data structures in R and how to work with them

  • Write customized R functions and handle recursions, exceptions in R environments

  • Create the data processing task as a step by step computer program and execute using dplyr

  • Extract and process unstructured text data

  • Interact with database management system to develop statistical applications

  • Formulate and implement parallel processing in R

  • In Detail

    R is a high-level statistical language and is widely used among statisticians and data miners for developing statistical applications. The objective of this book is to show how to work with different programming aspects of R. The emerging R developers and data science could have very good programming knowledge but might have limited understanding about R syntax and semantics. Our book will be a platform develop practical solution out of real world problem in scalable fashion and with very good understanding. You will work with various versions of R libraries that are essential for scalable data science solutions. You will learn to work with Input / Output issues when working with relatively larger dataset. At the end of this book readers will also learn how to work with databases from within R and also what and how meta programming helps in developing applications.

    Table of contents

    1. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Sections
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      5. Conventions
      6. Reader feedback
      7. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    2. Installing and Configuring R and its Libraries
      1. Introduction
      2. Installing and configuring base R in Windows
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      3. Installing and configuring base R in Linux
        1. Getting ready
        2. How to do it...
        3. There's more...
        4. See also
      4. Installing and configuring RStudio IDE in Windows
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      5. Installing and configuring RStudio IDE in Linux
        1. Getting ready
        2. How to do it…
        3. How it works...
        4. See also
      6. Installing and configuring R tools for Visual Studio in Windows
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. See also
      7. Installing R libraries from various sources
        1. Getting ready
        2. How to do it…
          1. The ggplot2 library
          2. The devtools library
          3. Installing a library from GitHub
          4. Installing a library from the BioC repository
        3. How it works…
        4. There's more…
        5. See also
      8. Installing a specific version of R library
        1. Getting ready
        2. How to do it…
        3. How it works…
    3. Data Structures in R
      1. Introduction
      2. Creating a vector and accessing its properties
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      3. Creating a matrix and accessing its properties
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      4. Creating a data frame and accessing its properties
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      5. Creating an array and accessing its properties
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      6. Creating a list from a combination of vector, matrix, and data frame
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      7. Converting a matrix to a data frame and a data frame to a matrix
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
    4. Writing Customized Functions
      1. Introduction
      2. Writing your first function in R
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There’s more…
      3. Writing functions with multiple arguments and use of default values
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There’s more…
      4. Handling data types in input arguments
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There’s more…
      5. Producing different output types and return values
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There’s more…
      6. Making a recursive call to a function
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There’s more…
      7. Handling exceptions and error messages
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There’s more…
        5. See also
    5. Conditional and Iterative Operations
      1. Introduction
      2. The use of the if conditional statement
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There’s more…
      3. The use of the if…else conditional operator
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There’s more…
      4. The use of the ifelse vectorised conditional operator
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There’s more…
        5. See also
      5. Writing a function using the switch operator
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There’s more…
      6. Comparing the performance of switch and series of the if…else statements
        1. Getting ready
        2. How to do it…
        3. How it works…
      7. Using for loop for iterations
        1. Getting ready
        2. How to do it…
        3. How it works…
      8. Vectorised operation versus for loop
        1. Getting ready
        2. How to do it…
        3. How it works…
    6. R Objects and Classes
      1. Introduction
      2. Defining a new S3 class
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      3. Defining methods for the S3 class
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      4. Creating a generic function and defining a method for the S3 class
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      5. Defining a new S4 class
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      6. Defining methods for an S4 class
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      7. Creating a function to return an object of the S4 class
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
    7. Querying, Filtering, and Summarizing
      1. Introduction
      2. Using the pipe operator for data processing
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      3. Efficient and fast summarization using the dplyr verbs
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      4. Using the customized function within the dplyr verbs
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more…
        5. See also
      5. Using the select verb for data processing
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more…
        5. See also
      6. Using the filter verb for data processing
        1. Getting ready
        2. How to do it...
        3. How it works...
      7. Using the arrange verb for data processing
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more…
      8. Using mutate for data processing
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more…
      9. Using summarise to summarize dataset
        1. Getting ready
        2. How to do it...
        3. How it works...
    8. R for Text Processing
      1. Introduction
      2. Extracting unstructured text data from a plain web page
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There’s more…
      3. Extracting text data from an HTML page
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      4. Extracting text data from an HTML page using the XML library
        1. Getting ready
        2. How to do it…
        3. How it works…
      5. Extracting text data from PubMed
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      6. Importing unstructured text data from a plain text file
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      7. Importing plain text data from a PDF file
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      8. Pre-processing text data for topic modeling and sentiment analysis
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      9. Creating a word cloud to explore unstructured text data
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      10. Using regular expression in text processing
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
    9. R and Databases
      1. Introduction
      2. Installing the PostgreSQL database server
        1. Getting ready
        2. How to do it…
        3. How it works…
      3. Creating a new user in the PostgreSQL database server
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      4. Creating a table in a database in PostgreSQL
        1. Getting ready
        2. How to do it...
        3. How it works…
        4. There's more…
      5. Creating a dataset in PostgreSQL from R
        1. Getting ready
        2. How to do it...
        3. How it works...
      6. Interacting with the PostgreSQL database from R
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more...
      7. Creating and interacting with the SQLite database from R
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more…
    10. Parallel Processing in R
      1. Introduction
      2. Creating an XDF file from CSV input
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      3. Processing data as a chunk
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      4. Comparing computation time with data frame and XDF
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
      5. Linear regression with larger data (rxFastLiner)
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also

    Product information

    • Title: Modern R Programming Cookbook
    • Author(s): Jaynal Abedin
    • Release date: October 2017
    • Publisher(s): Packt Publishing
    • ISBN: 9781787129054