A sample dataset representing longitudinal measurements for multiple patients over several time points.
Usage
data(data_longitudinal)
Format
A data frame with 140 rows and 3 variables:
- PatientID
Character. Unique identifier for each patient.
- Time
Integer. The time point at which the measurement was taken (e.g., day, week, month).
- Measurement
Numeric. The value of the measurement recorded at the given time point for the patient.
Examples
data(data_longitudinal)
str(data_longitudinal)
#> 'data.frame': 140 obs. of 3 variables:
#> $ PatientID : chr "PT1" "PT1" "PT1" "PT1" ...
#> $ Time : int 0 2 4 6 8 10 12 0 2 4 ...
#> $ Measurement: num 73.6 55 78.3 81.1 37.2 60.9 78.7 88.9 62.1 74 ...
head(data_longitudinal)
#> PatientID Time Measurement
#> 1 PT1 0 73.6
#> 2 PT1 2 55.0
#> 3 PT1 4 78.3
#> 4 PT1 6 81.1
#> 5 PT1 8 37.2
#> 6 PT1 10 60.9
summary(data_longitudinal$Measurement)
#> Min. 1st Qu. Median Mean 3rd Qu. Max.
#> 25.70 42.48 52.60 53.83 61.88 88.90
# Plot measurements for a specific patient (if plotting package loaded)
# if (requireNamespace("ggplot2", quietly = TRUE) && "PT001" %in% data_longitudinal$PatientID) {
# ggplot2::ggplot(data_longitudinal[data_longitudinal$PatientID == "PT001",],
# ggplot2::aes(x = Time, y = Measurement)) +
# ggplot2::geom_line() + ggplot2::geom_point() +
# ggplot2::ggtitle("Measurements for Patient PT001")
# }