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

service - Android MediaPlayer calls onCompletion before it already finished -

javascript - Training Neural Network to play flappy bird with genetic algorithm - Why can't it learn? -

javascript - Create a stacked percentage column -