-
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
parse_number
can't handle special space character as grouping_mark locale argument
#796
Comments
parse_number
can't handle special space character as grouping_mark argumentparse_number
can't handle special space character as grouping_mark locale argument
@jomuller another possible workaround waiting for a fix is
Minimal reprex: (num <- paste(1, 234.5, sep = "\U00A0"))
#> [1] "1 234.5"
library(readr)
parse_number(num, locale = locale(grouping_mark = "\U00A0"))
#> [1] 1
tidyr::extract_numeric(num)
#> extract_numeric() is deprecated: please use readr::parse_number() instead
#> [1] 1234.5 Created on 2018-02-17 by the reprex package (v0.2.0). |
@cderv Thank you for this workaround. Currently I'm using simply a regex to remove any non numeric character |
I've got two wrapper function in the tricky package. |
Closed by tidyverse/vroom@959b4b7, this should now be supported. |
Description
Using the
parse_number
function with a locale including special space character (e.g. : non breaking space) as an argument oflocale(grouping_mark = '\U202F')
don't lead to a properly parsed numberThis kind of space is often used in french as a separator (eg:
1 234,00
for the UK version of1,234.00
). An example of csv files containing this kind of character can be found following this link.Minimal reproducible example
What I already tried
R can reconize this character and a possible workaround is to
gsub
these character before proceding.Seems to come from internal method in readr. I tried to deep inside the code but my knowledge is too limited.
readr:::parse_vector_
call a functionreadr_parse_vector_
i can't find in the source code. It's maybe in the CPP part of the code but I have little knowledge on cpp.Session info
The text was updated successfully, but these errors were encountered: