dot-repeat_last: Last observation carried forward

.repeat_lastR Documentation

Last observation carried forward

Description

A helper function for making the multivariable regression table

Usage

.repeat_last(x, forward = TRUE, maxgap = Inf, na.rm = FALSE)

Arguments

x

A vector

forward

Logical; default is TRUE. Direction to carry forward. By specifying forward = FALSE, you can carry the last observation backward.

maxgap

Numeric; By specifying maxgap, you can choose not to bridge overly long gaps.

na.rm

Logical; default is FALSE. Whether to remove NAs.

Value

a vector similar to x.

References

https://stackoverflow.com/questions/7735647/replacing-nas-with-latest-non-na-value


emilelatour/latable documentation built on Sept. 14, 2023, 9:32 a.m.