I would like to register an S3 method for `is.unsorted` for my package's class "factor256" but I'm having trouble honouring the `strictly` argument. I've defined
is.unsorted.factor256 <- function(x, na.rm = FALSE, strictly = FALSE) { strictly } i.e. the class is sorted iff strictly = TRUE However, the strictly argument appears to be ignored x <- integer(2) class(x) <- "factor256" is.unsorted(x) # FALSE [expected] is.unsorted(x, strictly = TRUE) # FALSE [unexpected] The method is definitely being dispatched as when I change the function to is.unsorted.factor256 <- function(x, na.rm = FALSE, strictly = FALSE) { cat("dispatching\n") strictly } I see the dispatch: is.unsorted(ff, strictly = T) #> dispatching #> [1] FALSE and > methods("is.unsorted") [1] is.unsorted.factor256 see '?methods' for accessing help and source code I note that if I omit the na.rm = argument I will get the intended result (I was drawn to the solution by noting the .Internal call has omitted it) but I'm wondering whether this is correct. Best, Hugh Parsonage. ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel