8  Lecture: R Basics

8.1 R Basics lecture

Here’s a recording of this lecture (48 minutes 14 seconds):

Recording

8.2 R Basics slides

PDF slide set

8.3 Questions

8.3.1 Question 1

What does a <- 9; a < - 9 do?

8.3.2 Question 2

Given a vector x of length 10, which of the following R code snippets would remove the third element from the vector and assign the result to a new vector y? More than one option may be correct.

8.3.3 Question 3

Given the following vector:

x <- c(a = 1, b = 2, c = 3)

Which of the following R code snippets will extract only the element corresponding to the name “b”?

8.3.4 Question 4

Given the following R code:

x <- 1:6
dim(x) <- c(2, 3)

Which of the following options correctly extracts the second column of the matrix x as a column vector?

8.3.5 Question 5

Which of the following statements are true about data frames in R?