Skip to content

Commit

Permalink
More improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
NicChr committed Sep 23, 2024
1 parent 41e1d80 commit 44efcad
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 14 additions & 2 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -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, ...){
Expand All @@ -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), ...)
Expand Down

0 comments on commit 44efcad

Please sign in to comment.