Preface

R is designed for statistical computing, data analysis, and visualization. In recent years, it has become the most popular language for data science and statistics. R programming heavily involves data processing and it can be a challenge to program in R for those who are unfamiliar with the behaviors of the R language.

As a dynamic language, R allows extremely flexible use of data structures that are not as strict as compiled languages, such as C++, Java, and C#. When I started using R to process and analyze data, I found R’s behavior quirky, unpredictable, and sometimes very inconsistent.

In those data analysis projects, most effort was not spent running models. Instead, data cleaning, wrangling, and visualization took a major part of my time. In fact, it is most time consuming to find what’s wrong with the code that produced weird results or died in unexpected errors. Dealing with programming rather than field problems can be frustrating, especially when you have fought against bugs for hours without a clue.

However, as I work on more projects and gain more experience, I gradually know more about the behavior of objects and functions, and find that R is much more beautiful and consistent than I thought. That’s why I've written this book—to share my perspective on programming in R.

Through this book, you will develop a universal and consistent understanding of R as a programming language along with its vast set of tools. You will learn the best practices to boost your productivity, develop a deeper understanding of working with data, and become more confident about programming in R and solving problems with the right techniques.

What this book covers

Chapter 1, Quick Start, discusses a few basic facts about R, how to deploy an R environment, and how to code in RStudio.

Chapter 2, Basic Objects, introduces basic R objects and their behaviors.

Chapter 3, Managing Your Workspace, introduces the methods of managing the working directory, R environment, and the library of extension packages.

Chapter 4, Basic Expressions, covers the basic expressions of the R language: assignment, condition, and loop.

Chapter 5, Working with Basic Objects, discusses the basic functions each analyst should know in order to work with basic objects in R.

Chapter 6, Working with Strings, talks about R objects related with strings, and a number of string manipulation techniques.

Chapter 7, Working with Data, explains simple read/write data functions with some practical examples on various topics using basic objects and functions.

Chapter 8, Inside R, discusses R’s evaluation model by introducing what lazy evaluation, environment, function, and lexical scoping work is.

Chapter 9, Metaprogramming, introduces the metaprogramming techniques to help understand language objects and nonstandard evaluation.

Chapter 10, Object-Oriented Programming, describes the numerous object-oriented programming systems in R: S3, S4, RefClass, and community-provided R6.

Chapter 11, Working with Databases, shows how R works with popular relational databases such as SQLite and MySQL, and non-relational databases such as MongoDB and Redis.

Chapter 12, Data Manipulation, introduces techniques of manipulating relational data using data.table and dplyr, and non-relational data using rlist.

Chapter 13, High Performance Computing, discusses performance issues in R and several methods to boost computing performance.

Chapter 14, Web Scraping, talks about the basic structure of web pages, CSS, and XPath selectors and how to use the rvest package to scrape data from simple web pages.

Chapter 15, Boosting Productivity, demonstrates how R Markdown and shiny app, combined with interactive graphics, can boost productivity in the reporting and presentation of data analysis.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset