quantmod
quantmod copied to clipboard
Cl() fails on multiple calls w/ attribute based subsetting
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