R/url_encode.R

Defines functions url_encode

url_encode = function(x) {
    if (is.null(x)) {
        return(NULL)
    } else if (identical(class(x), "character")) {
        x = paste('\"', gsub(" ", "+", x), '\"', sep="")
    } else if (identical(class(x), "integer")) {
        # do nothing
    } else {
        stop("Invalid object passed to url_encode")
    }
    x = sprintf("[%s]", paste(x, collapse=","))
    return(x)
}
SquamataBase/RSquamataBase documentation built on April 27, 2020, 8:26 a.m.