课程: R for Data Science: Lunch Break Lessons

免费学习该课程!

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

Excel in R: AVERAGE

Excel in R: AVERAGE

- [Instructor] I'm using some spreadsheet functions to illustrate R programming. And this week, let's talk about average. We're looking at a spreadsheet and in cell G1, you can see the value 4.16 repeating. The function behind G1 is average of A1 through F1. Let's take a look at how that looks in R. So now we're looking at R and any time that you bring in a spreadsheet, you'll need to bring in the readxl library. There are other options but this is what I'm using now, so I run the library and in line five, I use as.data.frame and read_excel to bring that spreadsheet in and place it into a variable called Spreadsheet, and in the upper right-hand corner, you can see the variable Spreadsheet and a series of rows. These are actually the values of each column. So column one, column two, column three. So let's start off with the average of the first column. And we can do that in line nine. You can see that I've specified…

内容