September 2017
Beginner to intermediate
560 pages
25h 18m
English
The str() function gives a concise view of a data frame. In fact, we can use it to see the underlying structure of any arbitrary R object. The following commands and results show that the str() function tells us the type of the object whose structure we seek. It also tells us about the type of each of its component objects, along with an extract of some values. It can be very useful for getting an overview of a data frame.
> str(auto) 'data.frame': 398 obs. of 9 variables: $ No : int 1 2 3 4 5 6 7 8 9 10 ... $ mpg : num 28 19 36 28 21 23 15.5 32.9 16 13 ... $ cylinders : Factor w/ 5 levels "3cyl","4cyl",..: 2 1 2 2 4 2 5 2 4 5 ... $ displacement: num 140 70 107 97 199 115 304 119 ...
Read now
Unlock full access