课程: R for Data Science: Lunch Break Lessons

免费学习该课程!

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

Subsetting

Subsetting

- [Narrator] One of the really impressive features about r is it's ability to slice data with something called sub-setting. It's really important that you learn how to use sub-setting, it'll save you a lot of time. So let's take a look at that. First of all, let's look at the built in data constant called letters. And this is just a list of all the capital letters in the alphabet. I can do a quick sub set by typing in letters. And then a bracket and three. And what that's going to do is give me the third object of letters. I can pull of sets of elements, type in letters and I'll type in a bracket, and three colon five, which produces the third, fourth, and fifth element of letters. There's another way we can do this. Letters, bracket, and let's get three comma 20 colon 25. And what that'll produce is the third, and the 20, 21st, 22nd, 25th elements of letters. You can also exclude selections by typing in, there's letters, that's what we want to search through. And I don't want, that's…

内容