Learn R Programming

NMsim (version 0.2.4)

add: 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")

Value

A function that adds the specified text to character vectors

Arguments

...

Elements to add.

.pos

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

Examples

Run this code
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")

Run the code above in your browser using DataLab