Assume I have an empty tibble my_tbl
(0 rows) but whose column types are given. For example:
library(tibble)
library(lubridate)
my_tbl <- tibble(
x = integer(),
y = character(),
w = ymd(),
z = list()
)
How to randomly populate my_tbl
with n
rows (let's say n=10
for the sake of demonstration)?
If possible I am looking for a simple tidyverse
piece of code (but base R would be just fine too).
I understand that my requirements do not fully specify how to fill those rows but something that is not simply recycling a value for each column would already suffice. I'd like to have a simple way of randomly generating tibbles
given known column types. The ultimate goal is to run tests on these generated tibbles
.