Instructions for connecting to the server for class and for our research projects.

If you prefer to see videos, they are given at the top of the instruction page.

If you prefer written instructions, those are listed too.

There are instructions for both the Mac and Windows computers.

How to adjust the screen size? video instructions to adjust screen size. Also there are instructions for how to change the time and weather to the Lafayette, Indiana, area.

How to load R or Rstudio? video instructions to load R or Rstudio.

Starting point for many R resources: The R Project for Statistical Computing

Some helpful resources; you will find which ones suit you best (we are all open to feedback on these resources; please make suggestions if you want to add some here):

R has powerful graphical capabilities, which are easy to use: video of some example plots.

This video also shows how to install packages in R. When it becomes necessary, it will be helpful to see all Contributed Packages from CRAN.

To install packages (for example, here, the mapproj and then the maps package), type:

install.packages("mapproj")

install.packages("maps")

and then the R software will ask which mirror you want. Afterwards, the package will be installed.

Installations of packages only need to be done one time.

It is necessary, however, to load a package at the start of every session where you want to use it, for instance:

library(maps)

R can be used as a calculator: R code or the video about simple arithmetic

To find and open a file we worked on earlier in Rstudio, here are video instructions for opening files in Rstudio

Where should I store my files and folders? How are things structured on llc?

Here is a picture of the llc structure, and two videos that explain this structure:

video about the picture of the structure

and

video that demonstrates moving around the llc computer's directories.

If you want to save files into your group directory from within Rstudio itself,

here is a third resource, namely, a video about using Rstudio to save files in the right place

Here are the two sample files used in the video above: samplefile.R and samplefile2.R

We introduce vectors and recycling: R code or the video introduction to vectors and recycling

We experiment with uniform random numbers and for loops: R code or the video about uniform random numbers and for loops

We experiment with rolling 100 dice at random, and using vectorized operations to study the results: R code or the video about rolling dice

We experiment with generating some normally distributed random values,

and again we use vectorized operations to study the results: R code or the video about vectors of normally distributed values

We mention a few more functions for discrete values: R code or the video about more functions for discrete values

We discuss how to deal with NA values in a vector: R code or the video about NA values and how to handle them

A case study, looking carefully at the seq function: R code or the video about the seq function

A case study, looking carefully at the rep function: R code or the video about the rep function

A comprehensive look at how to index vectors: R code or the video about indexing vectors

R has some built-in data sets. We take a brief look at the co2 data, including some ways to use different ways to index this data:

R code or the video about built-in data and indexing carbon dioxide data

It is straightforward to write a function: R code or the video about writing a function

We define factors, levels, and data frames, using the CO2 (Carbon Dioxide Uptake in Grass Plants) built-in R example:

R code or the video about these definitions

R has several kinds of data types:

- scalar (can be logical, integer, double, complex, character, raw, and a few others...)
- vector (1 dimensional), matrix (2 dimensional), and array (multidimensional)
- factor (ordered sequence of data; the possible values are called levels)
- data frame (two dimensional data structure, where each column has the same length but different columns can have different types of data)
- list (an ordered collection of objects)
- formulas (used to show how variables are related)
- time series (data collected at several (usually uniform) points in time)
- shingles (typically used in lattice)
- dates and times
- connections (these allow R to communicate outside of the R platform)

- NA indicates a missing value
- NaN means "not a number"
- Inf and -Inf mean positive and negative infinity, respectively
- NULL is the null object