2.7 Quiz answers

  1. You must quote non-syntactic names with backticks: `: for example, the variables 1, 2, and 3.

    df <- data.frame(runif(3), runif(3))
    names(df) <- c(1, 2)
    
    df$`3` <- df$`1` + df$`2`
  2. It occupies about 8 MB.

    x <- runif(1e6)
    y <- list(x, x, x)
    obj_size(y)
    #> 8,000,128 B
  3. a is copied when b is modified, b[[1]] <- 10.