quantmod icon indicating copy to clipboard operation
quantmod copied to clipboard

Cl() fails on multiple calls w/ attribute based subsetting

Open ethanbsmith opened this issue 10 months ago • 0 comments

Description

[Describe the issue]

Expected behavior

the attribute base 'getter" functions only work on the original structure on which they were set. if subsequent calls are made to already subset data, they will fail. This is an edge case, but might be worth removing the attribute on the output value

Minimal, reproducible example

data(sample_matrix, package = "xts")
d <- as.xts(sample_matrix)

Cl(Cl(d)) #works fine

attr(d,"Cl") <- 4
> Cl(Cl(d))
Error in `[.xts`(x, , loc) : subscript out of bounds

Session Info

quantmod_0.4.26.1

ethanbsmith avatar Dec 23 '24 15:12 ethanbsmith