Skip to content

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

@ethanbsmith

Description

@ethanbsmith

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

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