tests/testthat/helper-string.R

# A replacement for stringr::str_count()
str_count <- function(x, pattern, fixed = TRUE) {
  loc <- gregexpr(pattern, text = x, fixed = fixed)
  unlist(lapply(loc, function(x) length(x[x > 0])))
}

# A replacement for stringr::str_detect()
str_detect <- function(x, pattern) {
  grepl(pattern, x = x)
}

Try the simtrial package in your browser

Any scripts or data that you put into this service are public.

simtrial documentation built on April 4, 2025, 5:08 a.m.