You are on page 1of 3

Coefficients

Intercept Dosage Age Sex


1 0 0 0

Flu Dosage Age Sex


0 16.9 50 1
0 17.0 50 1
0 17.5 47 1
0 17.4 49 1
0 18.3 42 1
0 18.0 47 1
0 17.9 49 1
0 17.5 55 1
0 18.0 51 1
0 14.2 52 2
0 18.2 52 1
0 18.9 55 1
1 15.7 49 2
0 20.1 54 1
1 20.0 55 1
0 20.2 53 1
0 18.2 44 2
0 17.1 54 2
0 21.4 53 1
0 21.3 56 1
1 17.9 57 2
0 19.2 51 2
0 19.3 53 2
1 23.5 51 1
1 19.5 55 2
1 23.2 59 1
1 20.6 47 2
1 21.3 54 2
0 21.2 56 2
1 21.8 51 2
1 21.7 58 2
1 23.5 53 2
0 25.1 46 1
1 26.4 41 2
1 25.8 48 1
1 26.2 43 2
This data set is the one we've been working with since the first lesson in this series. I've changed "Gets the flu" to "Flu" to mak

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)

Or just enter FluData to see the full data frame


"Gets the flu" to "Flu" to make it easier to handle in R

few lessons, because all the analysis is taken care of in R

ably the XLGetRange function in the DescTools package


e named R for Excel users

r library(DescTools)

first row containas variable labels

You might also like