R Programming By Example

This step-by-step guide demonstrates how to build simple-to-advanced applications through examples in R using modern tools.
Preview in Mapt

R Programming By Example

Omar Trejo Navarro

2 customer reviews
This step-by-step guide demonstrates how to build simple-to-advanced applications through examples in R using modern tools.

Quick links: > What will you learn?> Table of content> Product reviews

eBook
$28.00
RRP $39.99
Save 29%
Print + eBook
$49.99
RRP $49.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$28.00
$49.99
RRP $39.99
RRP $49.99
eBook
Print + eBook

Frequently bought together


R Programming By Example Book Cover
R Programming By Example
$ 39.99
$ 28.00
Statistics for Machine Learning Book Cover
Statistics for Machine Learning
$ 39.99
$ 28.00
Buy 2 for $35.00
Save $44.98
Add to Cart

Book Details

ISBN 139781788292542
Paperback470 pages

Book Description

R is a high-level statistical language and is widely used among statisticians and data miners to develop analytical applications. Often, data analysis people with great analytical skills lack solid programming knowledge and are unfamiliar with the correct ways to use R. Based on the version 3.4, this book will help you develop strong fundamentals when working with R by taking you through a series of full representative examples, giving you a holistic view of R.

We begin with the basic installation and configuration of the R environment. As you progress through the exercises, you'll become thoroughly acquainted with R's features and its packages. With this book, you will learn about the basic concepts of R programming, work efficiently with graphs, create publication-ready and interactive 3D graphs, and gain a better understanding of the data at hand. The detailed step-by-step instructions will enable you to get a clean set of data, produce good visualizations, and create reports for the results. It also teaches you various methods to perform code profiling and performance enhancement with good programming practices, delegation, and parallelization.

By the end of this book, you will know how to efficiently work with data, create quality visualizations and reports, and develop code that is modular, expressive, and maintainable.

Table of Contents

Chapter 1: Introduction to R
What R is and what it isn't
Comparing R with other software
The interpreter and the console
Tools to work efficiently with R
How to use this book
Tracking state with symbols and variables
Working with data types and data structures
Divide and conquer with functions
Complex logic with control structures
The examples in this book
Summary
Chapter 2: Understanding Votes with Descriptive Statistics
This chapter's required packages
The Brexit votes example
Cleaning and setting up the data
Summarizing the data into a data frame
Getting intuition with graphs and correlations
Creating a new dataset with what we've learned
Building new variables with principal components
Putting it all together into high-quality code
Summary
Chapter 3: Predicting Votes with Linear Models
Required packages
Setting up the data
Predicting votes with linear models
Checking model assumptions
Measuring accuracy with score functions
Programatically finding the best model
Predicting votes from wards with unknown data
Summary
Chapter 4: Simulating Sales Data and Working with Databases
Required packages
Designing our data tables
Simulating the sales data
Simulating the client data
Simulating the client messages data
Working with relational databases
Summary
Chapter 5: Communicating Sales with Visualizations
Required packages
Extending our data with profit metrics
Building blocks for reusable high-quality graphs
Starting with simple applications for bar graphs
Graphing disaggregated data with boxplots
Scatter plots with joint and marginal distributions
Developing our own graph type – radar graphs
Exploring with interactive 3D scatter plots
Looking at dynamic data with time-series
Looking at geographical data with static maps
Navigating geographical data with interactive maps
Summary
Chapter 6: Understanding Reviews with Text Analysis
This chapter's required packages
What is text analysis and how does it work?
Preparing, training, and testing data
Building the corpus with tokenization and data cleaning
Training models with cross validation
Improving our results with TF-IDF
Adding flexibility with N-grams
Reducing dimensionality with SVD
Extending our analysis with cosine similarity
Digging deeper with sentiment analysis
Testing our predictive model with unseen data
Retrieving text data from Twitter
Summary
Chapter 7: Developing Automatic Presentations
Required packages
Why invest in automation?
Literate programming as a content creation methodology
The basic tools for an automation pipeline
A gentle introduction to Markdown
Header Level  1
Extending Markdown with R Markdown
Developing graphs and analysis as we normally would
Building our presentation with R Markdown
Summary
Chapter 8: Object-Oriented System to Track Cryptocurrencies
This chapter's required packages
The cryptocurrencies example
A brief introduction to object-oriented programming
Introducing three object models in R – S3, S4, and R6
The architecture behind our cryptocurrencies system
Starting simple with timestamps using S3 classes
Implementing cryptocurrency assets using S4 classes
Implementing our storage layer with R6 classes
Retrieving live data for markets and wallets with R6 classes
Finally introducing users with S3 classes
Helping ourselves with a centralized settings file
Saving our initial user data into the system
Activating our system with two simple functions
Some advice when working with object-oriented systems
Summary
Chapter 9: Implementing an Efficient Simple Moving Average
Required packages
Starting by using good algorithms
How fast is fast enough?
Calculating simple moving averages inefficiently
Understanding why R can be slow
Measuring by profiling and benchmarking
Easily achieving high benefit - cost improvements
Using parallelization to divide and conquer
Using C++ and Fortran to accelerate calculations
Looking back at what we have achieved
Other topics of interest to enhance performance
Summary
Chapter 10: Adding Interactivity with Dashboards
Required packages
What is functional reactive programming and why is it useful?
Designing our high-level application structure
Inserting a dynamic data table
Introducing interactivity with user input
Adding a summary table with shared data
Adding a simple moving average graph
Adding interactivity with a secondary zoom-in graph
Styling our application with themes
Other topics of interest
Summary
Chapter 11: Required Packages
External requirements – software outside of R
Internal requirements – R packages
Loading R packages

What You Will Learn

  • Discover techniques to leverage R’s features, and work with packages
  • Perform a descriptive analysis and work with statistical models using R
  • Work efficiently with objects without using loops
  • Create diverse visualizations to gain better understanding of the data
  • Understand ways to produce good visualizations and create reports for the results
  • Read and write data from relational databases and REST APIs, both packaged and unpackaged
  • Improve performance by writing better code, delegating that code to a more efficient programming language, or making it parallel

Authors

Table of Contents

Chapter 1: Introduction to R
What R is and what it isn't
Comparing R with other software
The interpreter and the console
Tools to work efficiently with R
How to use this book
Tracking state with symbols and variables
Working with data types and data structures
Divide and conquer with functions
Complex logic with control structures
The examples in this book
Summary
Chapter 2: Understanding Votes with Descriptive Statistics
This chapter's required packages
The Brexit votes example
Cleaning and setting up the data
Summarizing the data into a data frame
Getting intuition with graphs and correlations
Creating a new dataset with what we've learned
Building new variables with principal components
Putting it all together into high-quality code
Summary
Chapter 3: Predicting Votes with Linear Models
Required packages
Setting up the data
Predicting votes with linear models
Checking model assumptions
Measuring accuracy with score functions
Programatically finding the best model
Predicting votes from wards with unknown data
Summary
Chapter 4: Simulating Sales Data and Working with Databases
Required packages
Designing our data tables
Simulating the sales data
Simulating the client data
Simulating the client messages data
Working with relational databases
Summary
Chapter 5: Communicating Sales with Visualizations
Required packages
Extending our data with profit metrics
Building blocks for reusable high-quality graphs
Starting with simple applications for bar graphs
Graphing disaggregated data with boxplots
Scatter plots with joint and marginal distributions
Developing our own graph type – radar graphs
Exploring with interactive 3D scatter plots
Looking at dynamic data with time-series
Looking at geographical data with static maps
Navigating geographical data with interactive maps
Summary
Chapter 6: Understanding Reviews with Text Analysis
This chapter's required packages
What is text analysis and how does it work?
Preparing, training, and testing data
Building the corpus with tokenization and data cleaning
Training models with cross validation
Improving our results with TF-IDF
Adding flexibility with N-grams
Reducing dimensionality with SVD
Extending our analysis with cosine similarity
Digging deeper with sentiment analysis
Testing our predictive model with unseen data
Retrieving text data from Twitter
Summary
Chapter 7: Developing Automatic Presentations
Required packages
Why invest in automation?
Literate programming as a content creation methodology
The basic tools for an automation pipeline
A gentle introduction to Markdown
Header Level  1
Extending Markdown with R Markdown
Developing graphs and analysis as we normally would
Building our presentation with R Markdown
Summary
Chapter 8: Object-Oriented System to Track Cryptocurrencies
This chapter's required packages
The cryptocurrencies example
A brief introduction to object-oriented programming
Introducing three object models in R – S3, S4, and R6
The architecture behind our cryptocurrencies system
Starting simple with timestamps using S3 classes
Implementing cryptocurrency assets using S4 classes
Implementing our storage layer with R6 classes
Retrieving live data for markets and wallets with R6 classes
Finally introducing users with S3 classes
Helping ourselves with a centralized settings file
Saving our initial user data into the system
Activating our system with two simple functions
Some advice when working with object-oriented systems
Summary
Chapter 9: Implementing an Efficient Simple Moving Average
Required packages
Starting by using good algorithms
How fast is fast enough?
Calculating simple moving averages inefficiently
Understanding why R can be slow
Measuring by profiling and benchmarking
Easily achieving high benefit - cost improvements
Using parallelization to divide and conquer
Using C++ and Fortran to accelerate calculations
Looking back at what we have achieved
Other topics of interest to enhance performance
Summary
Chapter 10: Adding Interactivity with Dashboards
Required packages
What is functional reactive programming and why is it useful?
Designing our high-level application structure
Inserting a dynamic data table
Introducing interactivity with user input
Adding a summary table with shared data
Adding a simple moving average graph
Adding interactivity with a secondary zoom-in graph
Styling our application with themes
Other topics of interest
Summary
Chapter 11: Required Packages
External requirements – software outside of R
Internal requirements – R packages
Loading R packages

Book Details

ISBN 139781788292542
Paperback470 pages
Read More
From 2 reviews

Read More Reviews

Recommended for You

Statistics for Machine Learning Book Cover
Statistics for Machine Learning
$ 39.99
$ 28.00
Deep Learning By Example Book Cover
Deep Learning By Example
$ 39.99
$ 28.00
RESTful Java Web Services - Third Edition Book Cover
RESTful Java Web Services - Third Edition
$ 35.99
$ 25.20
Matplotlib 2.x By Example Book Cover
Matplotlib 2.x By Example
$ 35.99
$ 25.20
Learn By Example: Statistics and Data Science in R [Video] Book Cover
Learn By Example: Statistics and Data Science in R [Video]
$ 49.99
$ 42.50
Rust Programming By Example Book Cover
Rust Programming By Example
$ 35.99
$ 25.20