trim_min_obs: Keep only groups (usually days) with enough observations.

Description Usage Arguments Examples

Description

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. To make sure enough observations of a particular variable are included, use trim_min_valid_obs.

Usage

1
trim_min_obs(data, grouping, min.obs = 2)

Arguments

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.

min.obs

The minimum number of observations to require. Defaults to 2.

Examples

1
2
# Trim the sleep dataset to have 2 obs per ID (this does nothing, but illustrates syntax)
trim_min_obs(sleep, grouping = 'ID', min.obs = 2)

seanchrismurphy/emacalc documentation built on May 12, 2019, 2:03 p.m.