课程: R for Data Science: Lunch Break Lessons

免费学习该课程!

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

Excel in R: CHOOSE

Excel in R: CHOOSE

- [Instructor] I'm using spreadsheet functions to illustrate programming in R. And this time around, let's take a look at choose. You'll notice that cell A10 equals seven and that's because I've used the formula CHOOSE, followed by five, followed by a range of values, A1, A2, A3, A4 and so on through B1. What this is saying is choose the fifth value from those values. If you count A1, A2, A3, A4, A5, you'll see that A5 is equal to seven and that's why A10 is equal to seven. Let's take a look at the R equivalent. So we're looking at R now. And in order to do spreadsheet type calculations, the first thing I'll need to do is import the spreadsheet. I bring in the readxl package with the library command. And then in line six, you'll notice that I'm importing the spreadsheet using the function read_excel. And you'll notice, I'm importing it as a matrix. And I'll explain why in just a second. In line nine, you'll see…

内容