Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

for data frames, recycle = TRUE drops attributes #524

Open
moodymudskipper opened this issue Mar 13, 2025 · 0 comments
Open

for data frames, recycle = TRUE drops attributes #524

moodymudskipper opened this issue Mar 13, 2025 · 0 comments
Milestone

Comments

@moodymudskipper
Copy link
Collaborator

We can't recycle args that have attributes that don't support recycling, which I think is all of those unless the class supports them.

A use case that might have all the corners we need : POSIXct with and without extra args

plt <- ggplot2::ggplot(cars[1:2,])
constructive::construct(ggplot2::layer_data(plt))
#> {constructive} couldn't create code that reproduces perfectly the input
#> ℹ Call `construct_issues()` to inspect the last issues
#> data.frame(PANEL = factor(c("1", "1")), group = -1L)
constructive::construct_issues()
#> `attr(original$group, 'n')` is an integer vector (1)
#> `attr(recreated$group, 'n')` is absent
constructive::construct(ggplot2::layer_data(plt), constructive::opts_data.frame(recycle = FALSE))
#> data.frame(
#>   PANEL = factor(c("1", "1")),
#>   group = c(-1L, -1L) |>
#>     structure(n = 1L)
#> )

Created on 2025-03-13 with reprex v2.1.0

@moodymudskipper moodymudskipper changed the title for data frames, recycle = TRUE drops args for data frames, recycle = TRUE drops attributes Mar 17, 2025
@moodymudskipper moodymudskipper added this to the 1.2.0 milestone Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant