Day 3 R questions


At the end of yesterday's class, I asked these questions. Here are the answers I was expecting.
  1. xx <- c(1, 7, 4, 31, 29)
    defines a new variable, or vector, with five numbers in it. It does not get displayed, just gets stored.
  2. xx
    prints the contents of our vector:
    [1] 1 7 4 31 29
  3. xx[4]
    prints only the fourth element:
    [1] 31
  4. xx[3] <- 7
    assigns a 7 to the third element of vector xx. Does not print anything.
  5. xx
    prints the new vector
    [1] 1 7 7 31 29