Quick start with R: Sub-setting (Part 9)

In Part 9, let’s look at sub-setting in R. Let’s provide summary tables on the following data set of tourists from different countries, the numbers of their children, and the amount of money they spent while on vacation. Copy and paste the following array into…

Quick start with R: Basic commands (Part 8)

In Part 8, let’s look at some basic commands in R. Set up the following vectors by cutting and pasting from this document: a <- c(3,-7,-3,-9,3,-1,2,-12, -14) b <- c(3,7,-5, 1, 5,-6,-9,16, -8) d <- c(1,2,3,4,5,6,7,8,9) Now figure out what each of the following commands…

Quick start with R: Basic plotting (Part 6)

In Part 6, let’s look at basic plotting in R. Try entering the following three commands together (the semi-colon allows you to place several commands on the same line). x <- seq(-4, 4, 0.2) ;  y <- 2*x^2 + 4*x – 7 plot(x, y) This…

Quick start with R: Exponential models (Part 5)

In Parts 3 and 4 we used the lm() command to perform least squares regressions. We saw how to check for non-linearity in our data by fitting polynomial models and checking whether they fit the data better than a linear model. Now let’s see how…

Quick start with R: More about regression (Part 3)

In Part 2 we created two variables and used the lm() command to perform a least squares regression on them, treating one of them as the dependent variable and the other as the independent variable. Here they are again. height = c(186, 165, 149, 206,…

Quick start with R

Many of you have heard of R (the R statistics language and environment for scientific and statistical computing and graphics). Perhaps you know that it uses command line input rather than pull-down menus. Perhaps you feel that this makes R hard to use and somewhat…

Installing R packages

Select CRAN server Click the R desktop icon to start R program. The start screen should look like the following. Click Packages on the main menu and then select Set CRAN mirror from the drop-down list. There are dozens of servers around the world from…