3.8 Quiz answers
The four common types of atomic vector are logical, integer, double and character. The two rarer types are complex and raw.
Attributes allow you to associate arbitrary additional metadata to any object. You can get and set individual attributes with
attr(x, "y")
andattr(x, "y") <- value
; or you can get and set all attributes at once withattributes()
.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.
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 usingI()
when creating a new data framedata.frame(x = I(matrix()))
.Tibbles have an enhanced print method, never coerce strings to factors, and provide stricter subsetting methods.