add: Create function that adds text elements to vector

View source: R/modifyHelpers.R

addR Documentation

Create function that adds text elements to vector

Description

Namely used to feed functions to modify control streams using 'NMsim()' arguments such as 'modify'. Those functions are often onveniently passed a function. 'add' and 'overwrite' are simple shortcuts to creating such functions. Make sure to see examples.

Usage

add(..., .pos = "bottom")

Arguments

...

Elements to add.

.pos

Either "top" or "bottom". Decides if new text is prepended or appended to existing text.

Value

A function that adds the specified text to character vectors

Examples

myfun <- add("b","d")
myfun("a")
## If more convenient, you can add a vector instead.
myfun2 <- add(c("b","d"))
myfun2("a")
myfun3 <- add("b","d",.pos="top")
myfun3("a")

NMsim documentation built on Sept. 9, 2025, 5:33 p.m.

Related to add in NMsim...