Skip to contents

chain multiple function to a call

Usage

obj %.% funcs

chain_sep(sep = "\\.\\.")

Arguments

obj

data object to apply function

funcs

function chains to apply to the data object

sep

separator for functions argument values

Value

the result of applying the chained functions to the data object

Note

chain_sep allows the user to preset the separator for the function chaining

e.g. you can call the function to set sep = "__" before using the

Examples

#use default sep ".."
1:3%.%unique..length
#> [1] 3
sample(1:1000,10,replace=TRUE) %.%unique..length
#> [1] 10
sample(1:10,10,replace=TRUE) %.%unique..cumsum
#> [1]  9 13 14 16 23 26

# set sep before function chaining
chain_sep("__")
sample(1:10,10,replace=TRUE) %.%unique__cumsum
#> [1] 10 16 21 23 27 34
sample(1:10,10,replace=TRUE) %.%unique__cumsum__length
#> [1] 7


# set sep before function chaining
chain_sep("X")
sample(1:10,10,replace=TRUE) %.%uniqueXcumsum
#> [1]  3 11 21 30 34