Professional Documents
Culture Documents
The range intended to contain the intercept and coefficients isn't necessary for this and the next few lessons, because all the a
We still need to get the data into R, and for an Excel user the best way to get data into R is probably the XLGetRange function
If you're not familiar with that function or package, have a look at Lynda.com's course named R for Excel users
If you have the DescTools package for R, and if you've installed it, we can move ahead
Begin by selecting the data range to move into an R data frame. In this example, that range is A5:D41.
You need not include the variable names, but this example assumes that you do so.
Leave the worksheet that contains the selected range active, and switch to R
If you haven't loaded it already, use library(DescTools) to load the package Switch to R and enter library(DescTools)
Import the data into an R data frame, which I wil call FluData. Use this command:
FluData <- XLGetRange(header = TRUE) where the header argument says that the first row containas variable la
You can check that the data came across as expected using the head function:
head(FluData)
r library(DescTools)