R/formula_fun.r

Defines functions str_combine str_split str_contains str_ends_with str_starts_with

# Functions that can be part of formulas in game structures etc.

str_starts_with = function(str, pattern) {
  str.starts.with(str,pattern)
}

str_ends_with = function(str, pattern) {
  str.ends.with(str,pattern)
}


str_contains = function(str,pattern) {
  has.substr(str,pattern)
}

str_split = function(str,pattern,ind) {
  restore.point("str_split")
  res = str.split(str,pattern)
  sapply(res, function(vec) vec[ind])
}

str_combine = function(...) {
  paste0(...)
}
skranz/gtree documentation built on March 27, 2021, 6:03 a.m.