Description Usage Arguments Examples
This function allows for trimming esm data down so that only days (or people) with a minimum number of observations
are included. If there is a 'missed' variable (coded 1 = missed) these rows will not be counted. Missing values
on the specified variables will also not be counted. Essentially, this ensures that there will be at least min.obs
number of valid values within each grouping factor retained. For a more general function, see trim_min_obs
.
1 | trim_min_valid_obs(data, grouping, variables, min.obs = 2)
|
data |
The input dataset |
grouping |
The grouping variables within which you require a minimum observation number. Could be just your person id or your person id and day. Should take the form of a character vector. |
variables |
The variables you require a certain number of values on. |
min.obs |
The minimum number of observations to require. Defaults to 2. |
1 2 | # Trim the sleep dataset to have 2 obs per ID (this does nothing, but illustrates syntax)
trim_min_valid_obs(sleep, grouping = 'ID', variables = 'extra', min.obs = 2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.