3.8 Quiz answers

  1. The four common types of atomic vector are logical, integer, double and character. The two rarer types are complex and raw.

  2. Attributes allow you to associate arbitrary additional metadata to any object. You can get and set individual attributes with attr(x, "y") and attr(x, "y") <- value; or you can get and set all attributes at once with attributes().

  3. The elements of a list can be any type (even a list); the elements of an atomic vector are all of the same type. Similarly, every element of a matrix must be the same type; in a data frame, different columns can have different types.

  4. You can make a list-array by assigning dimensions to a list. You can make a matrix a column of a data frame with df$x <- matrix(), or by using I() when creating a new data frame data.frame(x = I(matrix())).

  5. Tibbles have an enhanced print method, never coerce strings to factors, and provide stricter subsetting methods.