fill: Fill NA values in columns

fill_NAR Documentation

Fill NA values in columns

Description

Fill NA values in columns

Usage

fill_NA(.data, column, value, groups = "ID")

fill_locf(.data, column, groups = "ID", tolerance = Inf,
  time = "TIME", backfill = T)

fill_nocb(.data, column, groups = "ID", tolerance = Inf,
  time = "TIME", backfill = T)

Arguments

.data

A data.frame in which to modify the column

column

The column to modify as an unquoted name

value

A value or expression to use in replacing NA values

groups

A character vector of group column names

tolerance

A numeric value for the tolerance of the supplied time column. Defaults to Inf.

time

The column in .data (as a quoted string) that is used to determine if too much time has passed to carry values.

backfill

A logical value indicating whether NA values at the beginning of the vector should be filled backward from the next value. (for fill_nocb, fills terminal NA values from last value.) Defaults to TRUE.

Details

The fill_* functions update NA values in a data.frame column. fill_NA updates all NA values with the supplied value or expression fill_locf fills NA forward unless the difference in time exceeds tolerance. fill_nocb fills NA backward unless the difference in time exceeds tolerance. Both locf and nocb fills fill to the start and end (respectively) of the column. That is, for locf, if the first values are NA, they are filled back from the next non-NA value. Similare behavior is applied at the end of column in the case of nocb, when the final values are NA.

Value

the modified data.frame


qPharmetra/PMDatR documentation built on April 7, 2024, 5:42 p.m.