R/valid.R

setValidity("remoteDB",
            function(object) {
                if(length(object@name) == 0)
                    return("object needs a non-empty 'name'")
                if(length(object@url) == 0)
                    return("object needs a non-empty 'url'")
                if(!validURL(object@url))
                    return("object needs a 'url' of type 'http://'")
                TRUE
            })

validURL <- function(URL) {
    if(length(grep("^http://", URL)) > 0)
        TRUE
    else
        FALSE
}

Try the stashR package in your browser

Any scripts or data that you put into this service are public.

stashR documentation built on Jan. 15, 2017, 11:22 a.m.