Professional Documents
Culture Documents
Assignment #0
Assignment #0
Introduction to R
Due: Sept. 2 before class
(40 pts. Total)
Link to the appendix titled Using-R in our online textbook at https://www.otexts.org/fpp/using-r and
follow the instructions and links provided to:
a. Install R on your computer
b. Install RStudio on your computer
c. Install the package fpp on your RStudio
d. Download the dataset tute1.csv to your computer, and then import it into R-Studio
e. Follow the detailed instructions for the 16 steps in the Getting Started with R section of the
Using Rappendix.
Read and execute the laboratory called Introduction to R in ISLR on pages 42-51. As you practice the R
commands in the laboratory answer the following questions:
1. Write an R command to create the following matrix:
1 3 5
(7 2 3)
9 8 0
Execute the following sequence of commands:
> x <- rnorm(10)
> mean(x)
> var(x)
> y <- rnorm(10)
> mean(y)
> var(y)
2. Why did you not get the same values for the mean and variance of and if they were
obtained using the same command sequence?