R/util.R

Defines functions new_data_frame rbern

rbern <- function(n, p) {
  stats::runif(n) < p
}

# Much faster creation than with data.frame()
# https://stackoverflow.com/a/18748069/4550695
new_data_frame <- function(x, nrow) {
  structure(x, row.names = c(NA, -nrow), class = "data.frame")
}
Orion-Corporation/barts documentation built on July 13, 2022, 10:23 p.m.