wbs: WBS Vectors

Description Usage Arguments Value Examples

Description

\lifecycle

maturing

Create or test for objects of type "wbs". Parameters sep and width are not presently implemented.

See wbs_check() for more details on wbs validity checks.

Usage

1
2
3
as_wbs(x, sep = ".", width = NULL, .force = FALSE)

is_wbs(x)

Arguments

x

Object to be coerced or tested.

sep

Not yet implemented. String to split wbs on. Default is ".". Will not be used if width is specified.

width

Not yet implemented. Integer width that defines a wbs level in the overall string. Overrides sep if a value is given. For example, "010101" may be given to represent 1.1.1. In this case, width = 2.

.force

Logical whether to create the wbs even if an invalid entry is detected.

Value

as_wbs() attempts to coerce its argument to a wbs type. The input object x is first coerced with as.character(). The result is a vector of equal length to x.

is.character returns TRUE or FALSE depending on whether its argument is of wbs type or not.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# character vector with valid entries
x <- c("1", "1.1", "1.1.1", "1.2")
as_wbs(x)

is_wbs(x)
is_wbs(as_wbs(x))

# character vector with invalid entry '1.A1

y <- c("1", "1.1", "1.1.1", "1.2", "1.A")

  as_wbs(y)


as_wbs(y, .force = TRUE)

Technomics/wbstools documentation built on Jan. 28, 2020, 7:10 a.m.