R/findbars.R

findbars <-
structure(function (term) 
{
    if (is.name(term) || !is.language(term)) 
        return(NULL)
    if (term[[1]] == as.name("(")) 
        return(findbars(term[[2]]))
    if (!is.call(term)) 
        stop("term must be of class call")
    if (term[[1]] == as.name("|")) 
        return(term)
    if (length(term) == 2) 
        return(findbars(term[[2]]))
    c(findbars(term[[2]]), findbars(term[[3]]))
}, source = c("function (term) ", "{", "    if (is.name(term) || !is.language(term)) ", 
"        return(NULL)", "    if (term[[1]] == as.name(\"(\")) ", 
"        return(findbars(term[[2]]))", "    if (!is.call(term)) ", 
"        stop(\"term must be of class call\")", "    if (term[[1]] == as.name(\"|\")) ", 
"        return(term)", "    if (length(term) == 2) ", "        return(findbars(term[[2]]))", 
"    c(findbars(term[[2]]), findbars(term[[3]]))", "}"))

Try the frailtyHL package in your browser

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

frailtyHL documentation built on Dec. 1, 2019, 1:25 a.m.