Skip to contents

Checks that every tag supplied in ... obeys syntactic and value rules. Returns the cleaned list of tags if all checks pass.

Usage

dl_check_tags(
  ...,
  single = TRUE,
  na_allowed = FALSE,
  null_allowed = FALSE,
  tag_value_pattern = "^[A-Za-z0-9_.-]+( [A-Za-z0-9_.-]+)*$",
  verbose = FALSE
)

Arguments

...

Named tag arguments (tag = value).

  • wave A character vector specifying the waves to filter on.

  • type A character vector specifying the types to filter on.

  • name A character vector specifying the names to filter on.

  • version A character vector specifying the versions to filter on.

  • batch A character vector specifying the batches to filter on.

  • source A character vector specifying the sources to filter on.

single

Logical. If TRUE, each tag must be a scalar (length = 1). If FALSE, tag values may be character vectors. Default is TRUE.

na_allowed

Logical. If FALSE, no tag value may contain NA.

null_allowed

Logical. If FALSE, no tag value may be NULL.

tag_value_pattern

Regular expression that tag values must match. Defaults to ^[A-Za-z0-9_.-]+( [A-Za-z0-9_.-]+)*$ (letters, digits, underscore, hyphen, dot, and single internal spaces). Leading, trailing, and consecutive spaces stay forbidden: they are invisible in listings and S3 clients can mangle them. / and = stay forbidden because they are structural in datalake keys.

verbose

Logical. If TRUE, prints messages about the validation process. Default is FALSE.

Value

Invisibly returns a named list of validated tag values.

Examples

dl_check_tags(wave = "a", type = "raw")
dl_check_tags(wave = "Old Tracker")
dl_check_tags(batch = "1", version = "v2")
dl_check_tags(batch = "1", version = c("v1", "v2"), single = FALSE)
dl_check_tags(wave = NULL, null_allowed = TRUE)