-
Notifications
You must be signed in to change notification settings - Fork 286
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
should type_convert()
erase the 'spec' attribute?
#1032
Comments
|
type_convert()
set the 'spec' attribute?type_convert()
~~set~~ erase the 'spec' attribute?
type_convert()
~~set~~ erase the 'spec' attribute?type_convert()
erase the 'spec' attribute?
@jimhester, makes sense to me. I changed the issue title to reflect that. Do you want me to try a PR? |
Sure, you can actually just change the last line to be |
@jimhester, thanks for the suggestion. I forgot that was even an option. Would you prefer instead Does |
Fair questions, I am fine with doing |
closes #1032 (I realize I'm bending the [acknowledgement style](https://style.tidyverse.org/news.html#acknowledgement) by including Jim in this bullet. But it was his idea to remove the spec attribute, instead of update it.)
This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/ |
When
readr::type_convert()
is applied to a data.frame, should it update the 'spec' attribute? Currently, it does not, and potentially returns a misleading result.After the initial creation, the data.frame's spec attribute is correct (i.e., all columns are character).
Then
type_convert()
correctly converts everything to doubles.But the spec still shows the character vectors.
spec(d2)
BTW, I really like this function. It was nice when I was stacking a bunch of dataframe on top of each other, but some columns in some sub-dataframes were empty to the data types weren't compatible during the stack.
The text was updated successfully, but these errors were encountered: