Objects in R


In this lesson, you’ll learn some formal definitions and vocabulary for objects in R.

When you are finished, you should be able to…


Time Estimates:
     Videos: 40 min
     Readings: 15 min
     Activities: 5 min
     Check-ins: 2



Types and Structures


Required Video: Intro to Object Types and Structures



See the slides.     


Optional Reading: More Detail on Object Types and Structures




Check-In 1: Data Structures


This lecture did not mention the important structure of data frames.

That’s because, in essence, a data frame is simply a special list - with a few extra restrictions on the list format.

Think about the datasets you have already worked with. Which of the following restrictions on lists do you think are needed for the list to be a data frame?

  1. The elements of the list must all be vectors of the same length.
  2. The elements of the list must all be the same data type.
  3. The elements of the list must all have no missing values.
  4. The elements of the list must all have names.

Functions


Required Video: Intro to Functions



See the slides.     


Required Reading: Basics of R




Check-In 2: Troubleshooting


What is the reason for the error below? How would you fix it?

matrix(c("a", "b", "c", "d"), num_row = 2)
## Error in matrix(c("a", "b", "c", "d"), num_row = 2): unused argument (num_row = 2)