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

extract_numeric returns positive on negative numbers #20

Closed
barryrowlingson opened this issue Aug 14, 2014 · 1 comment
Closed

extract_numeric returns positive on negative numbers #20

barryrowlingson opened this issue Aug 14, 2014 · 1 comment

Comments

@barryrowlingson
Copy link

@barryrowlingson barryrowlingson commented Aug 14, 2014

extract_numeric("-123") returns 123, because all it does is strip anything not 0-9 or decimal point.

Its documentation is pretty thin too.

discussion here:
http://stackoverflow.com/questions/25291191/can-extract-numeric-deal-with-negative-numbers

@hadley hadley closed this in 633984d Aug 22, 2014
@gabx
Copy link

@gabx gabx commented Apr 20, 2015

extract_numeric("23 ft-lbs")
[1] NA
Warning message:
In extract_numeric("23 ft-lbs") : NAs introduced by coercion
The minus sign in the regex is maybe good for "-123" but leads to errors too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants