From the course: R for Data Science: Lunch Break Lessons

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

R data types: List

R data types: List

- [Instructor] When you're programming an R, there are several data structures that you want to be aware of, vectors, lists, matrices, erase, data frames, factors. Let's talk about lists. Lists are a special type of a vector but can store mixed types. So here's a vector and into that vector I'm going to store some values, a number, a logical value and a string. And when I hit return, you'll see that in the global environment, I have a value called I am a vector and it's got three elements, all of character type. Now let's build a list and we'll store exactly the same values. Now when I hit return, you'll notice that I've added I am a list to the global environment and it shows up as a list of three elements, let's take a look at the structure of each of those objects. So structure is abbreviated as STR and I hit parenthesis and I dot m a vector, let's take a look at the structure of I am a vector first. Now let's do the exact same thing with the list. And here's what we see, when I do…

Contents