tests/run_tests.R

library(testthat)

all_patterns <- function (x) {
	# get every permutation of elements in x,
	# collapse them with |.

	stopifnot (length(x) < 6)

	permutations <- sapply(
		combinat::permn(x),
		function (perm) {
			paste0(perm, collapse = ".+")
		})

	paste0(permutations, collapse = "|")
}

test_package('needy')

Try the needy package in your browser

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

needy documentation built on May 1, 2019, 8:44 p.m.