carry_over_values: Taking a vector, carry value over ('persistence')

View source: R/carry_over_values.R

carry_over_valuesR Documentation

Taking a vector, carry value over ('persistence')

Description

This function takes a value, and then replaces empty elements (NA or zero-length character values) with the last non-empty preceding element it encountered.

Usage

carry_over_values(x, noId = "no_id")

Arguments

x

The vector

noId

The value to add for the first empty elements

Value

The vector with the carries over elements

Examples

rock::carry_over_values(
  c(
    NA, NA, 3, NA, NA, 7, NA, NA
  )
);

gitlab-r-packages-mirror/rock documentation built on Dec. 3, 2024, 5:40 p.m.