View source: R/UniqueMeasurement.R
UniqueMeasurement | R Documentation |
Of the repeated measurements of an individual in the same census year, keep only the measurements (rows) taken at the highest POM (KeepMeas = "MaxHOM"), and/or the most recent measurement (same year but more recent date) (KeepMeas = "MaxDate")
UniqueMeasurement(Data, KeepMeas = c("MaxHOM", "MaxDate"), ID = "IdStem")
Data |
Dataset (data.table) |
KeepMeas |
In case of multiple measurements in the same census year: Possible values: "MaxHOM", "MaxDate" (character).
|
ID |
Column name indicating the identifier of the individual (character) |
Dataset (data.table) with 1 measurement (1 row) per Year.
library(data.table)
Data <- data.table( # 7 rows
IdStem = c(rep("a", 4), rep("b", 2), "c"),
Year = c(rep(2000, 3), 2001, rep(2000, 3)),
Date = as.Date(c("2000-01-10", "2000-01-20", "2000-01-30", "2001-01-10",
rep("2000-01-10", 3))),
HOM = c(rep(1, 3), 2, 1, 2, 1)
)
Data
UniqueMeasurement(TestData)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.