课程: R for Data Science: Lunch Break Lessons

免费学习该课程!

今天就开通帐号,24,100 门业界名师课程任您挑!

Data frames: Read and update

Data frames: Read and update

- [Narrator] When you're programming with R, you're going to be using a lot of data frames. And it's important to know how to add variables, delete variables, and change variables. So let's spend some time working with that. First of all, we need a bit of data. And let's take a quick look at the ChickWeight table. First of all, we use head, just to make sure that we move the promise. There. Now, let's say that we want to add a variable to the chick weight data frame. To do that, we specify the name of the variable we want to add, in this case I go down to the console window and I type in chickweight$ and we're going to add some numbers, and then I provide the value that I want to put into that variable. In this case. Now what you can see I've done is added a column, a variable, called SomeNumbers, it's numbered one through the length of chick weight. All I did was declare variable and then declare what I wanted to put into that variable. If I wanted to delete that variable, I would…

内容