diff --git a/R/utils.R b/R/utils.R index d73f24d..3787dc8 100644 --- a/R/utils.R +++ b/R/utils.R @@ -11,11 +11,11 @@ get_list_indexing <- function(this_list, index) { return(list("divisor" = divisor, "modulus" = modulus)) } -# Given a character vector, return an equal-length character vector of +# Given a character vector 'loops', return an equal-length character vector of # unique one-letter initials get_short_flags = function(loops) { # Try just taking the first letter of the names - short_flags = substr(names(loops), 1, 1) + short_flags = substr(loops, 1, 1) # Get unused letters remaining_letters = setdiff(letters, short_flags) @@ -29,3 +29,9 @@ get_short_flags = function(loops) { return(short_flags) } + +# Given a character vector 'vec', return a character(1) representing the line +# of code used to generate 'vec' +vector_as_code = function(vec) { + return(sprintf('c("%s")', paste(vec, collapse = '", "'))) +}