--Basics

The basic data structures in R can be organized by their dimensionality (1D, 2D, …, nD)

#Identifying the Data Structure

You can also use class

#Understanding Attributes

Some examples of R object attributes are:

  • names, dimnames

  • dimensions (e.g. matrices, arrays)

  • class (e.g. integer, numeric)

  • length

  • other user-defined attributes/metadata

Attributes of an object (if any) can be accessed using the attributes()function. Not all R objects contain attributes, in which case the attributes()function returns NULL.

#Exercises:

  1. Identify the data structure and attributes for the built-in sleep data set.

  2. Identify the data structure and attributes for the built-in state.name data set.

  3. Identify the data structure and attributes for the built-in Harman74.cordata set.

  4. Identify the data structure and attributes for the built-in WorldPhones data set.

  5. Bonus: Identify the data structure and attributes for the built-in Nile data set. What kind of data object is this?

Last updated