R/misc_generic.R

Defines functions string2list

#' Pipe operator
#'
#' @name %>%
#' @rdname pipe
#' @keywords internal
#' @export
#' @importFrom magrittr %>%
#' @usage lhs \%>\% rhs
NULL

string2list <- function(s, sep1="#", sep2="=", convert=function(x)x){
  l <- strsplit(s, split=sep1)[[1]]
  ll <- strsplit(l, split=sep2)
  a <- lapply(ll, function(x)x[2])
  names(a) <- lapply(ll, function(x)x[1])
  a <- lapply(a, convert)
  return(a)
}
maxwestphal/SEPM.SIM documentation built on April 11, 2024, 4:06 p.m.