Dr. Mark Gardener


GO... 

Beginning R: The Statistical Programming Languageby: Mark GardenerSupport and OutlineWelcome to the support page for my book, Beginning R. Here you will find a Table of Contents and brief outline to help you see what's included in each section of the book. The book includes many examples and there is a file that you can download, which contains the data and example code that is shown in the book. My publisher is also hosting an Instructor Support Site, where you can download additional materials to help you teach R. 

Beginning R is available from the publisher Wrox or see the entry on Amazon.co.uk. Get the example data used in the book Instructor materials available via Wiley Back to top 
Beginning R: The Statistical Programming Languageby: Mark GardenerConquer the complexities of this open source statistical language R is fast becoming the de facto standard for statistical computing and analysis in science, business, engineering, and related fields. This book examines this complex language using simple statistical examples, showing how R operates in a user–friendly context. Both students and workers in fields that require extensive statistical analysis will find this book helpful as they learn to use R for simple summary statistics, hypothesis testing, creating graphs, regression, and much more. It covers formula notation, complex statistics, manipulating data and extracting components, and rudimentary programming.
Beginning R offers anyone who needs to perform statistical analysis the information necessary to use R with confidence. The following outline covers each chapter of the book. 

Download the Beginning.RData file for the example data used in the book Back to top 
1 Introducing R: What It Is and How to Get ItWhat you will learn in this chapter
In this chapter you see how to get R and install it on your computer. You also learn how to access the builtin help system and find out about additional packages of useful analytical routines that you can add to R. 

Download the Beginning.RData file for the example data used in the book Back to top 
2 Starting Out: Becoming Familiar With RWhat you will learn in this chapter
This chapter builds some familiarity with working with R, beginning with some simple math and culminating in importing and making data objects that you can work with (and saving data to disk for later use). 

Download the Beginning.RData file for the example data used in the book Back to top 
3 Starting Out: Working With ObjectsWhat you will learn in this chapter
This chapter deals with manipulating the data that you have created or imported. These are important tasks that underpin many of the later exercises. The skills you learn here will be put to use over and over again. 

Download the Beginning.RData file for the example data used in the book Back to top 
4 Data: Descriptive Statistics and TabulationWhat you will learn in this chapter
This chapter is all about summarizing data. Here you learn about basic summary methods, including cumulative statistics. You also learn how about crosstabulation and how to create summary tables. 

Download the Beginning.RData file for the example data used in the book Back to top 
5 Data: DistributionWhat you will learn in this chapter
In this chapter you look at visualizing data using graphical methods—for example, histograms—as well as mathematical ones. This chapter also includes some notes about random numbers and different types of distribution (for example, normal and Poisson). 

Download the Beginning.RData file for the example data used in the book Back to top 
6 Simple Hypothesis TestingWhat you will learn in this chapter
In this chapter you learn how to carry out some basic statistical methods such as the ttest, correlation, and tests of association. Learning how to do these is helpful for when you have to carry out more complex analyses and also illustrates a range of techniques for using R. 

Download the Beginning.RData file for the example data used in the book Back to top 
7 Introduction to Graphical AnalysisWhat you will learn in this chapter
In this chapter you learn how to produce a range of graphs including bar charts, scatter plots, and pie charts. This is a “first look” at making graphs, but you return to this subject in Chapter 11, where you learn how to turn your graphs from merely adequate to simply stunning. 

Download the Beginning.RData file for the example data used in the book Back to top 
8 Formula Notation and Complex StatisticsWhat you will learn in this chapter
As your analyses become more complex, you need a more complex way to tell R what you want to do. This chapter is concerned with an important element of R: how to define complex situations. The chapter has two main parts; the first part shows how the formula notation can be used with simple situations. The second part uses an important analytical method, analysis of variance, as an illustration. The rest of the chapter is devoted to ANOVA. This is an important chapter because the ability to define complex analytical situations is something you will inevitably require at some point. 

Download the Beginning.RData file for the example data used in the book Back to top 
9 Manipulating Data and Extracting ComponentsWhat you will learn in this chapter
This chapter builds on the previous one. Now that you have seen how to define more complex analytical situations, you learn how to make and rearrange your data so that it can be analyzed more easily. This also builds on knowledge gained in Chapter 3. In many cases, when you have carried out an analysis you will need to extract data for certain groups; this chapter also deals with that, giving you more tools that you will need to carry out complex analyses easily. 

Download the Beginning.RData file for the example data used in the book Back to top 
10 Regression (Linear Modeling)What you will learn in this chapter
This chapter is all about regression. It builds on earlier chapters and covers various aspects of this important analytical method. You learn how to carry out basic regression as well as complex model building and curvilinear regression. It is also important because it illustrates some useful aspects of R (for example, how to dissect results). The later parts of the chapter deal with graphical aspects of regression, such as how to add lines of bestfit and confidence intervals. 

Download the Beginning.RData file for the example data used in the book Back to top 
11 More About GraphsWhat you will learn in this chapter
This chapter builds on the earlier chapter on graphics (Chapter 7) and also from the previous chapter on regression. It shows you how to produce more customized graphs from your data. For example, you learn how to add text to plots and axes, and how to make superscript and subscript text and mathematical symbols. You learn how to add legends to plots and how to add error bars to bar charts or scatter plots. Finally, you learn how to export graphs to disk as highquality graphics files, suitable for publication. 

Download the Beginning.RData file for the example data used in the book Back to top 
12 Writing Your Own Scripts  Beginning to ProgramWhat you will learn in this chapter
In this chapter you learn how to start producing customized functions and simple scripts that can automate your workflow and make complex and repetitive tasks a lot easier. 

Download the Beginning.RData file for the example data used in the book
Back to top 
Beginning R: Example data fileThe book includes many examples and these are included in the Beginning.RData file. Get the example dataYou can download that file by clicking on the link. This one file contains all the example datasets and scripts you need for the whole book. Install the example dataOnce you have the file on your computer you can load it into R by one of several methods:
If you have Windows or Macintosh you can load the file using menu commands or use a command typed into R:
The Beginning.RData file must be in your default working directory and if it is not you must specify the location as part of the filename. Alternatively you can find the working directory in R by using the getwd() command:
Then drag the Beginning.RData file into that directory and use the load() command:
Using the example dataR uses named objects so everything gets a name. You can see what is included in the Beginning.RData file by using the ls() command:
This will show you everything currently in the memory of R. Remember that names are case sensitive so that Qty is not the same as qty. There are four main kinds of object in the Beginning.RData file:
You can look at an object simply by typing its name. DataMany of the objects in the Beginning.RData file are data. For example the bv object shows some results for visits of bees to various colors of flower. > bv
These data are used to carry out a Goodness of fit test by comparing the observed visits to the theoretical ratio expected. ResultsSome of the objects in the Beginning.RData file are results. For example the pw.kw object shows the results of a KruskalWallis test. > pw.kw KruskalWallis rank sum test data: height by water The results of analyses are sometimes used for further analyses and to draw graphs. Oneline functionsR is very flexible and one useful aspect is the ability to create simple functions. For example the pn object is a function that applies a polynomial formula to any numerical value. > pn In this case the polynomial formula was taken from a previous analysis and is used to draw a line of bestfit onto a graph. Complex functions/scriptsIf you require a more complex task or want to automate your workflow, you can create a longer "script". The cum.fun object is an example of such a script. > cum.fun This script allows you to generate a cumulative statistic for a set of numbers. The default uses the median but you can specify any sensible function (the mean for example to create a running mean). 

Instructor materials available via Wiley  Instructor Support MaterialsInstructors (teachers, lecturers, professors) can now access a range of support materials via the Instructor Companion Site on the Wiley Higher Education website (you have to register but it is free). The materials include:
If you are an instructor and are teaching R then these materials can help you structure your course and provide you with additional materials that you can press into service as you like. 

Visit the R Project website  