-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Milestone
Description
Looks like negative n in shift functions works fine for integers but not doubles
library(data.table)
set.seed(108)
x=sample(5)
all.equal(shift(x, 1), shift(x, type="lag"))
#[1] TRUE
all.equal(shift(x, -1), shift(x, type="lead"))
#[1] TRUE
x=rnorm(5)
all.equal(shift(x, 1), shift(x, type="lag"))
#[1] TRUE
all.equal(shift(x, -1), shift(x, type="lead"))
#[1] "'is.NA' value mismatch: 1 in current 0 in target"
data.table(shift(x, -1), shift(x, type="lead"))
# V1 V2
#1: 0.00000000 -0.72878503
#2: -1.99289559 -0.06749116
#3: -0.72878503 -0.35050513
#4: -0.06749116 0.84235129
#5: -0.35050513 NAReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels