# A tibble: 3 × 4
patient_id pulse_1 pulse_2 pulse_3
<chr> <dbl> <dbl> <dbl>
1 XYZ 70 85 73
2 ABC 90 95 102
3 DEF 100 80 70
Lecture 8
Duke University
STA 199 - Spring 2024
2024-02-08
Go to your ae repo, click Pull to get today’s application exercise to get ready for later.
Questions from the prepare materials?
Suppose we have the following patient data:
# A tibble: 3 × 4
patient_id pulse_1 pulse_2 pulse_3
<chr> <dbl> <dbl> <dbl>
1 XYZ 70 85 73
2 ABC 90 95 102
3 DEF 100 80 70
And we want to know:
Average pulse rate for each patient.
Trends in pulse rates across measurements.
Suppose we have the following patient data:
# A tibble: 3 × 4
patient_id pulse_1 pulse_2 pulse_3
<chr> <dbl> <dbl> <dbl>
1 XYZ 70 85 73
2 ABC 90 95 102
3 DEF 100 80 70
And we want to know:
Average pulse rate for each patient.
Trends in pulse rates across measurements.
These require a longer format of the data where all pulse rates are in a single column and another column identifies the measurement number.
Type is how an object is stored in memory, e.g.,
double: a real number stored in double-precision floatint point format.integer: an integer (positive or negative)Class is metadata about the object that can determine how common functions operate on that object, e.g.,
factorYou’ll commonly encounter:
logicalintegerdoublecharacterYou’ll less commonly encounter:
listNULLcomplexrawYes, functions have types too, but you don’t need to worry about the differences in the context of doing data science.
A factor is a vector that can contain only predefined values. It is used to store categorical data.
Just a couple of examples…
ae-07-population-typesGo to the project navigator in RStudio (top right corner of your RStudio window) and open the project called ae.
If there are any uncommitted files, commit them, and then click Pull.
Open the file called ae-07-population-types.qmd and render it.