-
Notifications
You must be signed in to change notification settings - Fork 129
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
tibble preserves names attribute of added vector in column (and as.data.frame preserves as well) #837
Comments
Thanks. This has been added in tibble 3.0.0 as an experimental feature. |
Thank you for clarification that this is intended for a tibble. What about |
I missed that part. Can you show an example where this is important? |
It led to a hiccup in data processing of a package, see here https://stackoverflow.com/a/65646743/4640346, as the package did not cater for the case when there are names in columns (why should it? a data frame does not have them). Data was pruned by as.data.frame before processing. |
Let's remove inner names in |
- `as.data.frame.tbl_df()` strips inner column names (#837).
Done now, also tweaked documentation. |
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary. |
I wonder whether a tibble should preserve a vector's
names
attribute when added as a column or not. A data frame drops this attribute when a column is added.?tibble
might contain a hint that this is intended behaviour, but it is not clear from that ("tibble() is much lazier than base::data.frame() in terms of transforming the user's input. Character vectors are not coerced to factor. List-columns are expressly anticipated and do not require special tricks. Column names are not modified.").See the example below about the difference in behaviour.
I would "vote" mimicing base R data frame's behaviour here.
At least when converting back to data frame via
as.data.frame.tbl_df
the names attribute should be pruned from columns.The text was updated successfully, but these errors were encountered: