tidyverts / tsibble

Tidy Temporal Data Frames and Tools
https://tsibble.tidyverts.org
GNU General Public License v3.0
527 stars 49 forks source link

`tsibble::difference()` result length not matching input length. #310

Closed NicChr closed 3 weeks ago

NicChr commented 2 months ago

Hi, I noticed difference() returns a larger length vector than x if length(x) < differences. This differs from the documented return value: "A numeric vector of the same length as x."

packageVersion("tsibble")
#> [1] '1.1.4'
library(tsibble)
#> 
#> Attaching package: 'tsibble'
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, union
difference(1, differences = 3)
#> [1] NA NA NA

Created on 2024-05-12 with reprex v2.1.0