Book description
This stepbystep guide demonstrates how to build simpletoadvanced applications through examples in R using modern tools.
About This Book
 Get a firm hold on the fundamentals of R through practical handson examples
 Get started with good R programming fundamentals for data science
 Exploit the different libraries of R to build interesting applications in R
Who This Book Is For
This books is for aspiring data science professionals or statisticians who would like to learn about the R programming language in a practical manner. Basic programming knowledge is assumed.
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
In Detail
R is a highlevel 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 publicationready and interactive 3D graphs, and gain a better understanding of the data at hand. The detailed stepbystep 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.
Style and Approach
This is an easytounderstand guide filled with realworld examples, giving you a holistic view of R and practical, handson experience.
Publisher resources
Table of contents
 Preface

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

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 highquality code
 Summary
 Predicting Votes with Linear Models
 Simulating Sales Data and Working with Databases

Communicating Sales with Visualizations
 Required packages
 Extending our data with profit metrics
 Building blocks for reusable highquality 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 timeseries
 Looking at geographical data with static maps
 Navigating geographical data with interactive maps
 Summary

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 TFIDF
 Adding flexibility with Ngrams
 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

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

ObjectOriented System to Track Cryptocurrencies
 This chapter's required packages
 The cryptocurrencies example
 A brief introduction to objectoriented 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 objectoriented systems
 Summary

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

Adding Interactivity with Dashboards
 Required packages
 What is functional reactive programming and why is it useful?
 Designing our highlevel 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 zoomin graph
 Styling our application with themes
 Other topics of interest
 Summary
 Required Packages
Product information
 Title: R Programming By Example
 Author(s):
 Release date: December 2017
 Publisher(s): Packt Publishing
 ISBN: 9781788292542
You might also like
book
Machine Learning with R, the tidyverse, and mlr
Machine Learning with R, the tidyverse, and mlr gets you started in machine learning using R …
book
40 Algorithms Every Programmer Should Know
Learn algorithms for solving classic computer science problems with this concise guide covering everything from fundamental …
book
Data Science from Scratch, 2nd Edition
To really learn data science, you should not only master the tools—data science libraries, frameworks, modules, …
book
Storytelling with Data: A Data Visualization Guide for Business Professionals
Don't simply show your data—tell a story with it! Storytelling with Data teaches you the fundamentals …