L U R N

Let’s Use R Now…

A. Jonathan R. Godfrey

March 29, 2018
ISBN 978-0-473-17650-1

Please include the following details when citing this publication as a single volume.

Author:

Godfrey, A. Jonathan R.

Year:

2010

Title:

LURN: Let’s Use R Now

Publisher:

Institute of Fundamental Sciences, Massey University

Location:

Palmerston North, New Zealand

ISBN 978-0-473-17650-1

This e-text is made available for education purposes without any claim for financial recompense from the author. It is however intended that any use of the e-text, whether wholly or in part, be done with all parties being aware that the work is made available to any third party under the same conditions as placed on this volume.

This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-_nc-_nd/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.

Contents
1 What’s this all about?
 1.1 Getting started
 1.2 Versions of R
2 LURN… To Work R Blind
 2.1 Screen readers
 2.2 R and braille displays
 2.3 Setting up R as a blind Windows user
 2.4 Setting up R as a blind Mac user
 2.5 Setting up R as a blind Linux user
 2.6 Getting the most out of the R window
 2.7 More advanced ways of running R programs
3 LURN… To Enter Data
 3.1 Using R as a simple calculator
 3.2 A simple set of numbers
 3.3 A simple set of text values
 3.4 Logical indicators
 3.5 A note on subscripting
 3.6 A patterned set of numbers
 3.7 Less pattern and more repetition
 3.8 An incomplete pattern
 3.9 Dates and times
 3.10 Larger data objects
 3.11 Appropriate data labelling
 3.12 Other approaches
4 LURN… To Import Data
 4.1 Data from external files
 4.2 Data stored in another directory
 4.3 Data saved by other statistical software
 4.4 Data from files stored on the internet
 4.5 Data contained in contributed packages
 4.6 Data cleanliness
 4.7 Other packages
5 LURN… To Manipulate your Datasets
 5.1 Sorting the data into a different order
 5.2 Extracting data using information on one variable
 5.3 Extracting data using information on more than one variable
 5.4 Use of dplyr for data manipulation
6 LURN… To Export a Dataset
 6.1 Creating external files
 6.2 Exporting data for use in alternative software
7 LURN… To Create Simple Graphs
 7.1 Histograms
 7.2 Basic annotations to graphs
 7.3 Other univariate summary graphs
 7.4 Quantile-quantile plots
 7.5 Scatter plots
 7.6 Scatter plot matrices
 7.7 Graphs for discrete valued variables
 7.8 Closing
8 LURN… To Examine Data Numerically
 8.1 Obtaining basic numerical summaries of data
 8.2 Obtaining slightly more elegant summaries
 8.3 Getting things printed how we want them
 8.4 Correlation structure within a data set
 8.5 Use of dplyr for data summarisation
 8.6 Closing
9 LURN… To Save Results for Later Inspection
 9.1 Copying and pasting graphs
 9.2 Saving a graph using the menus
 9.3 Saving a graph using commands within your R program
 9.4 Saving output in a text file
 9.5 Saving the entire R Console
10 LURN… To Become More Efficient in your Workplace
 10.1 Managing R when you have multiple projects on the go
 10.2 Batch processing commands
 10.3 Running an R script without opening R under Windows
 10.4 Using file associations in Windows
 10.5 Don’t re-invent any wheels
11 LURN… To Do Basic Inference
 11.1 Confidence intervals and hypothesis tests for the mean of one population
 11.2 Confidence intervals and hypothesis tests for the difference of two population means
 11.3 Confidence intervals and hypothesis tests for a proportion from one population
 11.4 Confidence intervals and hypothesis tests for the difference of two population proportions
 11.5 Hypothesis tests and confidence intervals for Correlation coefficients
 11.6 Testing the independence of two categorical variables
 11.7 Testing the normality of a distribution
12 LURN… To Perform Regression Analyses
 12.1 Data and suitable exploratory graphs
 12.2 The simple regression model
 12.3 Presenting the straight line model’s suitability in a graph
 12.4 Model validation using diagnostic plots
 12.5 Polynomial regression models
 12.6 Presenting the polynomial model’s suitability in a graph
 12.7 Multiple regression models
 12.8 Indicator variables
13 LURN… To Perform Analyses of Variance (ANOVA)
 13.1 Data and suitable exploratory graphs
 13.2 One-way ANOVA
 13.3 Model validation using diagnostic plots
 13.4 Two-way ANOVA
14 LURN… To Perform Times Series Analyses
 14.1 Time series objects in R
 14.2 Time series plots
 14.3 Smoothing of a time series using moving averages
 14.4 Checking for stationarity
 14.5 Autocorrelation and partial autocorrelation
 14.6 Decomposition into seasonal and trend components
 14.7 Exponential smoothing
 14.8 Autoregressive models
 14.9 Basic ARIMA models
 14.10 Seasonality and ARIMA modelling
15 LURN… To Create Complex Graphs
 15.1 More than one graph in a single window
 15.2 Allowing different sized graphs to be included in a single window
 15.3 Using colour or different symbols
 15.4 Adding points to an existing graph
 15.5 Using lines instead of points
 15.6 Adding lines to an existing graph
 15.7 Adding a curve to a graph
 15.8 Adding text to an existing graph
 15.9 Adding a legend for different information within a graph
 15.10 More complex bar charts
 15.11 Contour plots
16 Extending R beyond the base installation
 16.1 Installing additional packages
 16.2 Updating add-on packages
 16.3 Using an enhanced graphical interface
 16.4 Use of an integrated development environment (IDE)
17 LURN… To use the BrailleR add-on package
 17.1 Creating a copy of the R console window
 17.2 Text interpretation of graphs
 17.3 Basic descriptions of variables
 17.4 Altering R output to make it easier to read
 17.5 Reading a scatter plot
 17.6 Creation of graphs with an accessible interactive tool for exploration
 17.7 What else?
18 LURN… To create maps
 18.1 Creation of maps
 18.2 Adding cities to a map
 18.3 Using Google’s services to map locations of interest
19 LURN… To Use R as a Scientific Calculator
 19.1 Trigonometric functions
 19.2 Graphs of trigonometric functions
20 LURN… To Use R for Basic Calculus Tasks
 20.1 Creating mathematical expressions
 20.2 Plotting functions
 20.3 Differentiation
21 LURN… To Use R for Linear Algebra
 21.1 Basic notes on storage of vectors and matrices
 21.2 Creating some simple matrix structures
 21.3 Matrix and vector calculations
 21.4 Inverting a matrix
 21.5 Solving a set of linear equations
 21.6 Determinants and traces
 21.7 Eigenvalues and eigenvectors
22 LURN… To Solve Operations Research Problems
 22.1 The Assignment Problem
 22.2 The transportation problem
Index

[next]