desc_from_comments: Backfill utility for descriptions

View source: R/utils.R

desc_from_commentsR Documentation

Backfill utility for descriptions

Description

A slightly more generic approach to getting model descriptions.

Usage

desc_from_comments(
  xpdb,
  start_check = ".*description",
  maxlines = 5,
  remove = paste0(start_check, ":\\s*"),
  extra_proc = c,
  collapse = " "
)

Arguments

xpdb

<xpose_data> or <xp_xtras> object

start_check

Regular expression used to mark start of description. This is tested case-insensitively.

maxlines

If the number of lines after description to the first code block is more than 1, this allows a limit.

remove

By default, the start check and a colon, with optional whitespace. A regex.

extra_proc

Any extra processing that might be desired prior to collapsing the description lines. This should be a vectorized function.

collapse

Character to use when collapsing multiple lines.

Value

The description-updated <xpose_data) object

See Also

set_prop()

Examples


# This has a description, but it's not visible by default
pheno_base

# It can be added with the following
pheno_base %>%
  desc_from_comments()

# Extra processing for preference can also implemented
pheno_base %>%
  desc_from_comments(extra_proc = tolower)

# If a run label ($PROB) would make a good description, use the
# following instead:
pkpd_m3 %>%
  set_prop(descr=get_prop(pkpd_m3,"label"))



xpose.xtras documentation built on April 4, 2025, 2:13 a.m.