Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

is.smart

Test For a Smart Object


Description

Tests an object to see if it is smart.

Usage

is.smart(object)

Arguments

object

a function or a fitted model.

Details

If object is a function then this function looks to see whether object has the logical attribute "smart". If so then this is returned, else FALSE.

If object is a fitted model then this function looks to see whether object@smart.prediction or object\$smart.prediction exists. If it does and it is not equal to list(smart.arg=FALSE) then a TRUE is returned, else FALSE. The reason for this is because, e.g., lm(...,smart=FALSE) and vglm(...,smart=FALSE), will return such a specific list.

Writers of smart functions manually have to assign this attribute to their smart function after it has been written.

Value

Returns TRUE or FALSE, according to whether the object is smart or not.

Examples

is.smart(sm.min1)  # TRUE
is.smart(sm.poly)  # TRUE
library(splines)
is.smart(sm.bs)  # TRUE
is.smart(sm.ns)  # TRUE
is.smart(tan)  # FALSE
## Not run: 
udata <- data.frame(x2 = rnorm(9))
fit1 <- vglm(rnorm(9) ~ x2, uninormal, data = udata)
is.smart(fit1)  # TRUE
fit2 <- vglm(rnorm(9) ~ x2, uninormal, data = udata, smart = FALSE)
is.smart(fit2)  # FALSE
fit2@smart.prediction

## End(Not run)

VGAM

Vector Generalized Linear and Additive Models

v1.1-5
GPL-3
Authors
Thomas Yee [aut, cre], Cleve Moler [ctb] (author of several LINPACK routines)
Initial release
2021-01-13

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.