Categories Pricing Corporate
Free Textbook

A Step-by-Step R Tutorial

An introduction into R applications and programming

0 Reviews
2 Reviews
Language:  English
A Step-by- Step Tutorial in R has a two-fold aim: to learn the basics of R and to acquire basic skills for programming efficiently in R.
Download free PDF textbooks or read online. Less than 15% adverts
Business subscription free for the first 30 days, then $5.99/mo

A Step-by- Step Tutorial in R has a two-fold aim: to learn the basics of R and to acquire basic skills for programming efficiently in R. Emphasis is on converting ideas about analysing data into useful R programs. It is stressed throughout that programming starts first by getting a clear understanding of the problem. Once the problem is well formulated the next phase is to write step-by-step code for execution by the R evaluator. Although A Step-by-Step Tutorial in R is primarily intended as a course directed by an instructor, it can also be used  with a little more effort  as a self-teaching option. The first 11 chapters form the core and deal with management of R objects, workspaces, functions, graphics, data structures, subscripting, search paths, evaluation environments, vectorised programming, mapping functions, loops, error tracing and statistical modelling. The optional final chapters take a closer look at analysis of variance and covariance and optimization techniques.

  1. Preface 
  2. Acknowledgement 
  3. Introducing the R system
    1. Introduction 
    2. Downloading the R system 
    3. A quick sample R session 
    4. R: An interpretive computer language 
    5. A closer look at the R console 
    6. More R basics 
    7. Regular expressions in R: The basics
    8. From single instructions to sets of instructions: Introducing R functions 
    9. R within the Windows environment 
    10. Working with RStudio 
    11. Using R Commander 
    12. Activating an R project 
    13. A note on computations by a computer 
    14. Built-in data sets in R 
    15. The use of .First() and .Last() 
    16. Options
    17. R output (text and graphics) to Microsoft Word 
    18. Creating PDF and HTML documents from R output: R package knitr
    19. Command line editing 
  4. Managing objects 
    1. Creating separate workspaces for each project 
    2. Instructions and objects in R
    3. How R finds data 
    4. The organization of data (data structures) 
    5. Time series 
    6. The functions and 
    7. Simple manipulations; numbers and vectors 
    8. Objects, their modes and attributes 
    9. Representation of objects
    10. Exercise
  5. R operators and functions 
    1. Arithmetic operators 
    2. Logical operators 
    3. The operators <-, <<- and ~ 
    4. Operator precedence 
    5. Introduction to functions in R 
    6. Some mathematical functions 
    7. Differentiation and integration 
    8. Exercise 
  6. Introducing traditional R graphics 
    1. General 
    2. High-level plotting instructions
    3. Interactive communication with graphs
    4. 3D graphics: Package rgl 
    5. Exercise
  7. Subscripting
    1. Subscripting with vectors 
    2. Subscripting with matrices 
    3. Extracting elements of lists 
    4. Extracting elements from dataframes 
    5. Combining vectors, matrices, lists and dataframes 
    6. Rearranging the elements in a matrix 
    7. Exercise 
  8. Revision tasks
    1. Guidelines for problem solving by writing R code 
    2. Exercise
  9. Writing functions in R 
    1. General 
    2. Writing a new function 
    3. Checking for object name clashes 
    4. Returning multiple values 
    5. Local variables and evaluation environments 
    6. Cleaning up 
    7. Variable number of arguments: argument … 
    8. Retrieving names of arguments: Functions deparse() and substitute()
    9. Operators 
    10. Replacement functions 
    11. Default values and lazy evaluation 
    12. The dynamic loading of external routines 
  10. Vectorized programming and mapping functions 
    1. Mapping functions to a matrix
    2. Mapping functions to vectors, dataframes and lists 
    3. The functions: mapply(), rapply() an Vectorize() 
    4. The mapping function tapply() for grouped data 
    5. The control of execution flow statement if-else and the control functions ifelse() and switch() 
    6. Loops in R 
    7. The execution time of R tasks 
    8. The calling of functions with argument lists 
    9. Evaluating R strings as commands 
    10. Object-oriented programming in R 
    11. Recursion 
    12. Environments in R 
    13. “Computing on the language” 
    14. Writing user friendly functions in R: The function menu() 
    15. Exercise 
    16. The function on.exit() 
    17. Error tracing 
    18. Error handling: The function try() 
  11. Reading data files into R, formatting and printing 
    1. Reading Microsoft Excel files into R 
    2. Reading other data files into R 
    3. Sending output to a file 
    4. Writing R objects for transport 
    5. The use of the file .Rhistory and the function history() 
    6. Command re-editing 
    7. Customized printing 
    8. Formatting numbers 
    9. Printing tables 
    10. Communicating with the operating system 
    11. Exercise 
  12. R graphics: Round II
    1. Graphics parameters 
    2. Layout of graphics
    3. Low-level plotting commands
    4. Using the plotting commands 
    5. Exact distances in graphics 
    6. Multiple graphics windows in R 
    7. More complex layouts
    8. Dynamic 3D graphics in R 
    9. Animation 
    10. Exercise 
  13. Statistical modelling with R
    1. Introduction
    2. Data for statistical models 
    3. Expressing a statistical model in R 
    4. Common arguments to R modelling functions 
    5. Using the statistical modelling objects 
    6. Usage of the function with() 
    7. Linear regression and anova 
    8. The function glm()
    9. The function gam()
    10. The function loess() 
    11. The function rpart() 
    12. Nonlinear regression and the function nls() 
    13. Normal quantile plot 
    14. A coplot with two conditioning variables 
    15. Regression diagnostics 
    16. Experimental design 
    17. Consider the following data 
  14. Analysis of Variance and Covariance with R 
    1. One-way ANOVA models 
    2. Two-way ANOVA models: Main effects and interaction effects 
    3. One-way ANCOVA models 
    4. Maize example 
    5. Heart rate example
  15. Introduction to Optimization 
    1. The bisection method for solving f (x) = 0 
    2. The Newton-Raphson method
    3. The R functions optim()and constrOptim()
    4. Packages quadprog, lpSolve and Rsolnp for constrained optimization 
  16. References and Further Reading
  17. Endnotes 
  18. Index

The best book for my course
Excellent for studying computer programming.
More reviews
About the Authors

Niël J le Roux

Sugnet Lubbe