Combines two values. For most values, child
is returned in place
of parent
. Exeptions are formulas (converted to quosures
and evaluated with the object parent
and objects from the
CascadingTheme's data
field available), functions (evaluated
on the parent
if there is one), and cascading_element()
s (values
are merged recursively). Use rlang::as_box()
to cascade items
without applying any class-based rules, and rlang::zap()
to
remove a key from the parent cascading_element()
.
cascade(parent, child = missing_value(), cascading_theme = NULL) # S3 method for default cascade(parent, child = missing_value(), cascading_theme = NULL) # S3 method for `function` cascade(parent, child = missing_value(), cascading_theme = NULL) # S3 method for quosure cascade(parent, child = missing_value(), cascading_theme = NULL) # S3 method for formula cascade(parent, child = missing_value(), cascading_theme = NULL) reverse_cascade(child, parent = missing_value(), cascading_theme = NULL) # S3 method for default reverse_cascade(child, parent = missing_value(), cascading_theme = NULL) # S3 method for `function` reverse_cascade(child, parent = missing_value(), cascading_theme = NULL) # S3 method for quosure reverse_cascade(child, parent = missing_value(), cascading_theme = NULL) # S3 method for formula reverse_cascade(child, parent = missing_value(), cascading_theme = NULL) # S3 method for cascading_element reverse_cascade(child, parent = missing_value(), cascading_theme = NULL)
parent | The value to be inherited from |
---|---|
child | The value to inherit |
cascading_theme | The CascadingTheme object from which |
# in most cases, child is returned in place parent cascade("parent value", "child value")#> [1] "child value"# formulas/quosures can use `parent` (tidy evaluation is supported) # and data supplied by the theme cascade( "parent value", ~paste(parent, "child value", sep = separator), CascadingTheme$new(data = list(separator = "=>")) )#> [1] "parent value=>child value"# items of cascading elements are merged recursively using the # same rules cascade( cascading_element(key1 = "parent value 1", key2 = "parent_value 2"), cascading_element( key1 = "child value 1", key2 = ~paste(parent, "child value2", sep = separator) ), CascadingTheme$new(data = list(separator = "=>")) )#> $key1 #> [1] "child value 1" #> #> $key2 #> [1] "parent_value 2=>child value2" #> #> attr(,"class") #> [1] "cascading_element"