sparse: Detect sparse sampling occasions

View source: R/sparse.R

sparseR Documentation

Detect sparse sampling occasions

Description

sparse() detects differentiates between clusters of consecutive samples and more spread out, or "sparse," samples in a NONMEM-formatted data set.

Usage

sparse(data, min_cluster = 3, max_distance = 26, plot = FALSE)

Arguments

data

A data frame or data frame extension in NONMEM format.

min_cluster

The minimum size of a cluster of consecutive observations to be considered intensive (i.e. not sparse) sampling.

max_distance

The maximum allowed distance between the earliest and latest observation of a single cluster.

plot

Logical. Whether to make a plot of individual PK curves with sparse observations labeled.

Details

For each ID, sparse() iterates through each line of the data set until it finds an observation. It then checks for "neighbors," meaning consecutive observations without a dose record in between. Any group of min_cluster or more observations within at most max_distance from one another is considered a cluster.

Value

A tibble::tibble() with an appended column, SPARSE, containing a 1 for all observation points not contained in a cluster, and a 0 otherwise.

Author(s)

Sandy Floren


saviclab/savictools documentation built on Dec. 7, 2023, 11:56 p.m.