You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Simple issues I've solved (but I'm still open to suggestions):
Ignore common attributes that don't need to be columns like "class" and "names"
Handle "row.names" as a special case and call rownames_to_column()
Automatically rename conflicting names. A parameter can disable it.
Bigger questions:
If an attribute vector has 1 or nrow values, it's simple. But what if a vector has any other number of values?
What about values that aren't a vector? Like a data frame or nested list or S3 object? One option here is to just skip it and warn about any attributes that were skipped.
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.
The text was updated successfully, but these errors were encountered:
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.htmlIt'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):
rownames_to_column()
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.
The text was updated successfully, but these errors were encountered: