Hello, my name is David Christensen, and in these lessons, you will learn about working with two -dimensional data, including data frames and tables, as well as using these data structures within lists. You will learn how to use them to store and organize your data. In this lesson, I will show you how to use and create data frames in R. To demonstrate data frames, I have a file saved on my desktop. The file is called inventions . csv. Let's have a quick look to see what this file looks like. This is two -dimensional data with an invention column, a year column, and an inventor column. To import this data with an R, we could use read .csv, and in between the parentheses, we can type the path to the file or the name of the file if it's in our current directory. My current directory is my desktop, so I'll go ahead and type the name of the file, and press Ctrl -Enter on my keyboard. This prints out a data frame, which is two -dimensional data, not unlike a spreadsheet. Each of the columns represents a vector of data. We can assign the data frame as an object name. I'll call this inventions. The inventions data frame is now available in the environment. If we want to look at a specific variable within inventions, we can access it by typing the name of the data frame, followed by a dollar sign, and then the column or vector that we want to access. For example, if we wanted to see the vector of inventions, we could type the word invention and press Ctrl -Enter. This gives us access to the vector within the data frame. We can use the structure function to investigate the different columns of data within our data frame. The structure function is str, and within str we can put the name of the data frame, inventions. In the console, we get some information about the data frame. It tells us that this is an object data frame with four observations of three variables, and we get each of the variables, year, invention, and inventor. It tells us the data type for the different columns. The year column is automatically interpreted as an integer type, and the invention and inventor columns are interpreted as type character. This is significantly more information than if we put inventions within class. For example, if we put inventions within class, you'll see that it returns type data frame with no other information. So the structure function is the one to use to see more detailed information about a data frame. We can use the data frame function to create a data frame. The data frame function is data .frame, and within data frame, we can put the data frame that we want. And so what we need to do is add the vectors that we would like included within the data frame. Let's make a data frame with some more inventions. We'll add a column for year, and we'll set this equal to a vector. And within the vector, we'll add the dates 1960 and 1913. If we went ahead and ran this line of code as is, it produces a data frame with a single vector within it. Let's go ahead and add some additional columns to this data frame. So I'll add a comma after the last vector, and now I'll add a invention column. We'll add the inventions laser and refrigerator. Since this is going to be character data, both of these values need to be within quotation marks. So I'll highlight laser and add quotation marks, and same for refrigerator. If we try running this data frame, we now have two columns of data. So two vectors, one for year and one for invention. Let's go ahead and add one more. I've added another column for inventor, and now if we run the data frame function, we get a data frame with three columns of data. We can assign this data frame a name. I'll call this more inventions. We've seen two data frames thus far, the inventions data frame that we loaded from a CSV file, as well as the more inventions data frame that we created from scratch. We can combine these data frames using the rbind function. The rbind function takes two values. These are the names of the data frames we are going to combine. So this will be inventions and the data frame more inventions. When we run this line of code, we get a single data frame that has combined our two data frames together. We can assign this combined data frame an object name. I've called it combined inventions, and now it is available in the environment.