tidyverse / tibble

A modern re-imagining of the data frame
https://tibble.tidyverse.org/
Other
671 stars 130 forks source link

An `attributes_to_columns()` function #1585

Open steveharoz opened 4 months ago

steveharoz commented 4 months ago

There are some differences in opinion about what information should go in a data frame vs appear as attributes. An issue with attributes is that accessing a tibble's attributes and its data often requires breaking a piped statement. An example of such a conflict is with emmeans - https://rvlenth.github.io/emmeans/reference/untidy.html

It's much easier to implement a workaround rather than unify everyone's opinion. So I'd like to propose an attributes_to_columns() function. It would add each of a tibble's attribute as a column.

Here is a rough early implementation.

Simple issues I've solved (but I'm still open to suggestions):

Bigger questions:

Is this something the tibble maintainers would be interested in? If so, I can flesh out and polish the gist more to make into a proper PR.

krlmlr commented 4 months ago

Thanks. I'm not sure if tibble is the right venue, can we prototype elsewhere and decide based on that?