r - Why using `attr(x, "class")` instead of `class(x)`? -


the function model.frame.default runs following code; is.null(attr(data, "class")). question is, why using attr in case? wouldn't more straight forward use is.null(class(data))? (and doesn't contradict said here: why names(x) better attr(x, "names")?)

these not equivalent. compare output of class(1) attr(1, "class"). latter returns explicit s3 classes, former implicit classes.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -