Skip to content

seq.nanoduration overspecifies 'seq()' (4 arguments) #151

@MichaelChirico

Description

@MichaelChirico

nanotime/R/nanoduration.R

Lines 676 to 685 in e2486c4

seq.nanoduration <- function(from, to=NULL, by=NULL, length.out=NULL, along.with=NULL, ...) {
## workaroud 'bit64' bug:
if (is.null(by)) {
if (is.null(length.out)) {
length.out <- length(along.with)
}
by = (to - from) / (length.out - 1)
}
as.nanoduration(seq(as.integer64(from), to, as.integer64(by), length.out, along.with, ...))
}

Hit by {nanotime} test suite:

expect_identical(seq(as.nanoduration("00:00:00"), to=as.nanoduration("00:00:09"), length.out=10),
as.nanoduration(seq(0, by=1e9, length.out=10)))

The version of {bit64} on its way to CRAN breaks this because seq.integer64 was overhauled to match seq.default behavior and error when receiving 4 non-NULL arguments:

seq(1, 2, by=1, length.out=2) # technically, no contradiction, but still errors
# Error in seq.default(1, 2, by = 1, length.out = 2) : too many arguments

## CRAN bit64
seq(bit64::as.integer64(1), 2, by=1, length.out=2)
# integer64
# [1] 1 2

## devel bit64
# Error in seq.integer64(...) : too many arguments

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions