Skip to contents

Create synthetic timestamps either by mimicking an existing POSIXct vector (using its range and NA rate) or by sampling uniformly between start and end.

Usage

generate_fake_posixct_column(
  like = NULL,
  n = NULL,
  start = NULL,
  end = NULL,
  tz = "UTC",
  na_prop = NULL
)

Arguments

like

Optional POSIXct vector to mimic. If supplied, n defaults to length(like), the output range matches range(like, na.rm = TRUE), and the NA rate is copied unless you override with na_prop.

n

Number of rows to generate. Required when like is NULL.

start, end

Optional POSIXct bounds to sample between when like is NULL.

tz

Timezone to use if like has no tzone (default "UTC").

na_prop

Optional NA proportion to enforce in the output (0–1). If NULL and like is provided, it copies the NA rate from like. If like is NULL, defaults to 0.

Value

A POSIXct vector of length n.