diff --git a/NAMESPACE b/NAMESPACE index 4d71031..b314d35 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -3,6 +3,8 @@ S3method(base::as.character,vctrs_rcrd) S3method(base::as.double,integer64) S3method(base::as.integer,integer64) +S3method(collapse::ffirst,integer64) +S3method(collapse::flast,integer64) S3method(collapse::fmax,integer64) S3method(collapse::fmean,integer64) S3method(collapse::fmedian,integer64) diff --git a/R/utils.R b/R/utils.R index fca7c6a..e984195 100644 --- a/R/utils.R +++ b/R/utils.R @@ -154,8 +154,12 @@ as.integer.integer64 <- function(x, ...){ # They are obviously slow but at least result is correct #' @exportS3Method collapse::fsum -fsum.integer64 <- function(x, ...){ - collapse::fsum(cpp_int64_to_numeric(x), ...) +fsum.integer64 <- function(x, g = NULL, ...){ + if (is.null(g)){ + collapse::fsum(cpp_int64_to_numeric(x), ...) + } else { + collapse::fsum(as.double(x), ...) + } } #' @exportS3Method collapse::fmin fmin.integer64 <- function(x, ...){ @@ -165,6 +169,14 @@ fmin.integer64 <- function(x, ...){ fmax.integer64 <- function(x, ...){ cpp_numeric_to_int64(collapse::fmax(cpp_int64_to_numeric(x), ...)) } +#' @exportS3Method collapse::ffirst +ffirst.integer64 <- function(x, ...){ + cpp_numeric_to_int64(collapse::ffirst(cpp_int64_to_numeric(x), ...)) +} +#' @exportS3Method collapse::flast +flast.integer64 <- function(x, ...){ + cpp_numeric_to_int64(collapse::flast(cpp_int64_to_numeric(x), ...)) +} #' @exportS3Method collapse::fmean fmean.integer64 <- function(x, ...){ collapse::fmean(cpp_int64_to_numeric(x), ...)