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

Use readr::type_convert #107

Closed
hadley opened this issue Sep 23, 2015 · 2 comments
Closed

Use readr::type_convert #107

hadley opened this issue Sep 23, 2015 · 2 comments
Labels
feature a feature request or enhancement table 🏓

Comments

@hadley
Copy link
Member

hadley commented Sep 23, 2015

And expose col_types argument

@cjyetman
Copy link

cjyetman commented Nov 6, 2019

Please also expose the na argument of readr::type_convert (or the na.strings argument of utils::type.convert) so that one can correctly parse a table that includes a legitimate "NA" string, e.g.

html_string <- 
"<table>
<tr><td>MM</td><td>Myanmar</td></tr>
<tr><td>NA</td><td>Namibia</td></tr>
<tr><td>NR</td><td>Nauru</td></tr>
</table"

rvest::minimal_html(html_string) %>% 
  rvest::html_node("table") %>% 
  rvest::html_table()
#     X1      X2
# 1   MM Myanmar
# 2 <NA> Namibia
# 3   NR   Nauru

@hadley
Copy link
Member Author

hadley commented Jan 6, 2021

I decided it was too much work for relatively little gain to use readr here, so I just added the na.strings argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement table 🏓
Projects
None yet
Development

No branches or pull requests

2 participants