Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,16 @@
Because there was no recorded direct usage for any of these, I am opting to just rip the band-aid
off and un-export them in this release as opposed to waiting a full cycle more to do so.

1. `as.integer64.integer64` returns a plain `integer64` vector stripped by any attributes. This is consistent with R like behavior e.g. `as.integer.integer`.

## NEW FEATURES

1. `anyNA` gets an `integer64` method. Thanks @hcirellu.

## BUG FIXES

1. `min.integer64`, `max.integer64` and `range.integer64` now support `na.rm=TRUE` correctly when combining across mutliple inputs like `min(x, NA_integer64_, na.rm=TRUE)` (#142).
1. `as.integer64.integer64` is consistent with R like behavior like `as.integer.integer` in terms or returning a plain integer64 vector (#188).

## NOTES

Expand Down
10 changes: 9 additions & 1 deletion R/integer64.R
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,15 @@ as.integer64.NULL <- function(x, ...) {

#' @rdname as.integer64.character
#' @export
as.integer64.integer64 <- function(x, ...) x
as.integer64.integer64 = function(x, ...) {
ret = unclass(x)
attributes(ret) = NULL
# if keep.names is added as argument
# if (isTRUE(keep.names))
# names(ret) = names(x)
oldClass(ret) = "integer64"
ret
}

#' @rdname as.integer64.character
#' @export
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-integer64.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ test_that("integer64 coercion to/from other types work", {
expect_identical(as.integer64(as.character(1:10)), as.integer64(1:10))
expect_identical(as.integer64(as.double(1:10)), as.integer64(1:10))
expect_identical(as.integer64(NULL), as.integer64())
x = as.integer64(1:10)
expect_identical(as.integer64(x), x)
x = structure(as.integer64(1:10), class=c("otherClass", "integer64"), dim=c(2, 5), dimnames=list(LETTERS[1:2], letters[1:5]), otherAttr="some other attribute")
expect_identical(as.integer64(x), as.integer64(1:10))

# S4 version
expect_identical(methods::as(as.character(1:10), "integer64"), as.integer64(1:10))
Expand Down