@robert-a contributed the following helper function which makes rcw.parameters a little easier - we should consider adding it to rcloud.web:
#' Get URL Parameter
#'
#' Gets a parameter value from the URL parameter list
#'
#' @param parm desired parameter
#' @param default default value if parameter is not present
#' @param split character to use to split the value into a vector
#'
#' @return Parameter value
#'
#' @examples
#' Val <- get_URLparms("MyParm", default="test")
#' Vals <- get_URLparms("Vlist", default="A|B|C", split="|") # c("A", "B", "C")
get_URLparms <- function(parm,default=NA,split=NA, ... ) {
#####################################################################
## function to get a parameter value from the URL list ##
## ex: RACP_nb <- get_URLparms("notebook", default="dummy") # "18f65ac2a12ff217d2a"
## ex: myletts <- get_URLparms("letters", default="a-b-c", split="-") # "a","b","c"
#####################################################################
require(rcloud.web)
# Get the URL parameters #
if(!exists("RCAP_URL_parms")) { RCAP_URL_parms <<- rcw.parameters() }
# Get the requested URL parameter #
value <- default
if(parm %in% names(RCAP_URL_parms)) value <- RCAP_URL_parms[[parm]]
# if there is a split char, split value into a vector #
if(!is.na(split) && grepl(split,value) ) value <- unlist(strsplit(value,split=split,fixed=TRUE))
return(value)
}
@robert-a contributed the following helper function which makes
rcw.parameters
a little easier - we should consider adding it to rcloud.web: