R/element.r

Defines functions elements

## elements <- function(x) {
##   xx <- paste(x, "~ 1")
##   f <- as.formula(xx)
##   if (grepl("^Surv\\(", x) | grepl("^I\\(", x) | grepl("factor\\(", x))
##     res <- x
##   else
##     res <- sapply(f[[2]], function(y) deparse(y, 500))
##   if (res[1] == ":") {
##     res <- paste(res[-1], collapse = ":")
##   }
##   res[res != "cbind"]
## }

elements <- function(x) {
  xx <- paste(x, "~ 1")
  f <- as.formula(xx)
  if (grepl("^cbind\\(", x))
    res <- sapply(f[[2]], function(y) deparse(y, 500))
  else
    res <- x
  res[res != "cbind"]
}

Try the remix package in your browser

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

remix documentation built on May 29, 2017, 5:50 p.m.