ptd_target: Target

Description Usage Arguments Details Value Examples

View source: R/ptd_target.R

Description

Produces an object that can be used for adding Targets to an SPC chart. This method provides two different ways to add a target:

  1. You can either provide a single value, which will apply the same target to every facet of an SPC

  2. You can provide named values of targets, where the names correspond to the names of the facets, in order to have different targets for each facet

Usage

1

Arguments

...

either a single values, or, named values of targets. See examples.

Details

This function is a helper to provide data in the correct format for use with ptd_spc(). See Value section for details of return type. If you are trying to do something like ptd_spc(list_of_values) then you can skip using the function and just use list_of_values, so long as the list meets the requirements as listed above.

Value

returns either:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# if you aren't using a facetted chart, or you want to use the same target for each facet, you
# can simply call this method with a single value. For example, to use a target of 90%:

ptd_target(0.9)

# if you are using a facetted chart, and wish to use a different target for each facet, then you
# can call this method, naming each value with the name of the facet. Any facet that isn't listed
# will not have a target applied to it.

# For example, to apply a target of 25 to the "a" facet and 10 to the "b" facet:

ptd_target(
  "a" = 25,
  "b" = 10
)

# If you already have your data in a list, you do not need to use ptd_target(). But, if you
# wanted to check that your values are valid, you could call it like so:

my_targets <- list("a" = 25, "b" = 10)
do.call(ptd_target, my_targets)

# or, if your targets are in a numeric vector
my_targets <- c("a" = 25, "b" = 10)
do.call(ptd_target, as.list(my_targets))

NHSRplotthedots documentation built on Nov. 4, 2021, 1:07 a.m.