# 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
2024-05-28
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.,
factor
You’ll commonly encounter:
logical
integer
double
character
You’ll less commonly encounter:
list
NULL
complex
raw
Yes, 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-types
Go 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.