R/nobars.R

nobars <-
structure(function (term) 
{
    if (!("|" %in% all.names(term))) 
        return(term)
    if (is.call(term) && term[[1]] == as.name("|")) 
        return(NULL)
    if (length(term) == 2) {
        nb <- nobars(term[[2]])
        if (is.null(nb)) 
            return(NULL)
        term[[2]] <- nb
        return(term)
    }
    nb2 <- nobars(term[[2]])
    nb3 <- nobars(term[[3]])
    if (is.null(nb2)) 
        return(nb3)
    if (is.null(nb3)) 
        return(nb2)
    term[[2]] <- nb2
    term[[3]] <- nb3
    term
}, source = c("function (term) ", "{", "    if (!(\"|\" %in% all.names(term))) ", 
"        return(term)", "    if (is.call(term) && term[[1]] == as.name(\"|\")) ", 
"        return(NULL)", "    if (length(term) == 2) {", "        nb <- nobars(term[[2]])", 
"        if (is.null(nb)) ", "            return(NULL)", "        term[[2]] <- nb", 
"        return(term)", "    }", "    nb2 <- nobars(term[[2]])", 
"    nb3 <- nobars(term[[3]])", "    if (is.null(nb2)) ", "        return(nb3)", 
"    if (is.null(nb3)) ", "        return(nb2)", "    term[[2]] <- nb2", 
"    term[[3]] <- nb3", "    term", "}"))

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.