Learning R [PDF]

Learning R
Learning R

R is a programming language and a software environment for data analysis and statistics. It is a GNU project, which means that it is free, open source software. It is growing exponentially by most measures—most estimates count over a million users, and it has over 4,000 add-on packages contributed by the community, with that number increasing by about 25% each year. The Tiobe Programming Community Index of language pop‐ularity places it at number 24 at the time of this writing, roughly on a par with SAS and MATLAB.
R is used in almost every area where statistics or data analyses are needed. Finance, marketing, pharmaceuticals, genomics, epidemiology, social sciences, and teaching are all covered, as well as dozens of other smaller domains.

About This Book

Since R is primarily designed to let you do statistical analyses, many of the books written about R focus on teaching you how to calculate statistics or model datasets. This un‐fortunately misses a large part of the reality of analyzing data. Unless you are doing
cutting-edge research, the statistical techniques that you use will often be routine, and the modeling part of your task may not be the largest one. The complete workflow for analyzing data looks more like this:

  1. Retrieve some data.
  2. Clean the data
  3. Explore and visualize the data
  4. Model the data and make predictions
  5. Present or publish your results

Of course at each stage, your results may generate interesting questions that lead you to look for more data, or for a different way to treat your existing data, which can send you back a step. The workflow can be iterative, but each of the steps needs to be undertaken.

The first part of this book is designed to teach you R from scratch—you don’t need any experience in the language. In fact, no programming experience at all is necessary, but if you have some basic programming knowledge, it will help. For example, the book
explains how to comment your code and how to write a for loop, but doesn’t explain in great detail what they are. If you want a really introductory text on how to program, then Python for Kids by Jason R. Briggs is as good a place to start as any!

The second part of the book takes you through the complete data analysis workflow in R. Here, some basic statistical knowledge is assumed. For example, you should under‐ stand terms like mean and standard deviation, and what a bar chart is.

The book finishes with some more advanced R topics, like object-oriented programming and package creation. Garrett Grolemund’s Data Analysis with R picks up where this book leaves off, covering data analysis workflow in more detail.

A word of warning: this isn’t a reference book, and many of the topics aren’t covered in great detail. This book provides tutorials to give you ideas about what you can do in R and let you practice. There isn’t enough room to cover all 4,000 add-on packages, but
by the time you’ve finished reading, you should be able to find the ones that you need, and get the help you need to start using them.

What Is in This Book

This is a book of two halves. The first half is designed to provide you with the technical skills you need to use R; each chapter is a short introduction to a different set of data types (for example, Chapter 4 covers vectors, matrices, and arrays) or a concept (for
example, Chapter 8 covers branching and looping).

Which Chapters Should I Read?

If you have never used R before, then start at the beginning and work through chapter by chapter. If you already have some experience with R, you may wish to skip the first chapter and skim the chapters on the R core language.

Each chapter deals with a different topic, so although there is a small amount of dependency from one chapter to the next, it is possible to pick and choose chapters that interest you.
I recently discussed this matter with Andrie de Vries, author of R For Dummies. He suggested giving up and reading his book instead!

You can also get this PDF by using our Android Mobile App directly:


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.