jitter_dates: Jitter Dates

Description Usage Arguments Value

View source: R/jitter_dates.R

Description

This function creates a lookup dataframe where one column is the original key of an input dataframe and the other is a random number of days (by patient) to jitter the dates

Usage

1
jitter_dates(dataset, keycol_name, date_cols, direction = "backward", lookup)

Arguments

dataset

The input data.frame that contains a column which is the key (unique identifier)

keycol_name

A string that is the name of the column that the unique id is located in dataset

date_cols

A named vector of strings where the elements are the names of the columns in dataset that are presumed dates. The names of the elements are the lubridate-esque formats of the dates, e.g. "mdy_hms"

direction

Should the function jitter dates forward or backward? Defaults to "backward"

lookup

lookup is a 2-column dataframe with the first column being the key and the second column being the number of days to jitter. Usually the output from create_jitter_dt

Value

The original dataframe with all dates jittered


michaelgao8/dukeehR documentation built on May 4, 2019, 4:23 p.m.