Takes a function name and a character vector to be put inside independent calls of the function.

createStringFunction(fun, inside = NULL)

Arguments

fun

character - the fucntion name as a string

inside

character vector - the items to put inside function

Value

character vector - of the form [1]"fun(inside[1])" ... [n]"fun(inside[n]))" where n is the lengh of inside. If inside is NULL it returns an empty string

Examples

createStringFunction("library", c("ggplot2", "dyplr"))
#> [1] "library(ggplot2)" "library(dyplr)"
#[1] "library(ggplot2)" "library(dyplr)" createStringFunction("library")
#> [1] ""
#[1] ""