Closed cgiachalis closed 1 year ago
No, you generally don't need to check that the class of the object matches the class of the method. That said, I do notice people often call methods directly, especially if they're exported. This is likely due to auto-completion in their IDE (e.g. RStudio).
That line of code has been there for ~10 years now. I'm not inclined to remove it unless there's a very good reason. Is this causing an issue for you, or are you asking because you're curious?
Thanks Joshua.
No, it's not an issue at all. It's more a question of consistency, i.e., na.omit()
or split()
do not check that the class of the object matches the class of the method.
There's no need to include this line in an unexported method. I'll remove it. It was added in early 2009, before R required packages to have namespaces... in late 2011. Ooof, feeling old.
Do we need
stopifnot(is.xts(object))
in a xts method?