knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The R package wbstools
contains functions to assist in working with work breakdown structures.
The development version can be installed from GitHub with:
# install.packages("devtools") devtools::install_github("costverse/wbstools")
Use as_wbs()
to convert a character vector into one of class wbs
. The result is still a character vector, but will print differently to the console.
library(wbstools) x <- c("1", "1.1", "1.1.1", "1.10", "1.2", "1.1.3", "1.1.10", "1.1.28", "1.3.4") example_wbs <- as_wbs(x) example_wbs
This shows how example_wbs
is still just a character vector when you strip the class.
is_wbs(example_wbs) is_wbs(unclass(example_wbs)) unclass(example_wbs)
The class is integrated into tibbles. Notice how the column type is of wbs
and not chr
.
df_wbs <- tibble::tibble(wbs = example_wbs, value = runif(length(x))) df_wbs
The wbs
column is formatted to have equal width padding for each level. For example, line 3 shows as 1.01.01. This is only formatting. The data is not changed and is still stored as 1.1.1.
df_wbs$wbs
Use sort()
and arrange_wbs()
to correctly sort a wbs.
sort(example_wbs)
df_wbs %>% arrange_wbs(wbs)
Build out more details on df_wbs
using wbs_expand()
. The function will look for the first column of class wbs
to produce the expanded view on.
In this case, a warning is issued that 1.3 is missing from the wbs. There is an orphaned child element 1.3.4.
wbs_expand(df_wbs)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.