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

[Request] Strip commas from columns declared numeric in fread #1723

Closed
SteveBronder opened this issue May 26, 2016 · 4 comments
Closed

[Request] Strip commas from columns declared numeric in fread #1723

SteveBronder opened this issue May 26, 2016 · 4 comments

Comments

@SteveBronder
Copy link

A common problem when moving data from excel to R is that excel leaves commas in numbers if the user is not careful. Would it be possible to, as the data is being read through in fread, if the past X rows were numeric and the newest row has a comma, strip the comma and continue with the column being numeric?

I was thinking something similar to this stackoverflow answer

setAs("character", "num.with.commas", 
        function(from) as.numeric(gsub(",", "", from) ) )

The user could have an option commaNumeric = TRUE such that when true fread will rip commas out of columns it has already declared numeric after the first 30 rows or so.

P.S. thanks for the package, it's really wonderful!

@arunsrinivasan
Copy link
Member

Thanks. Many fread enhancements are planned for next release.

@jaapwalhout
Copy link

Would be nice, but could this interfere with European style decimal separator (which is a comma)?

@MichaelChirico
Copy link
Member

@jaapwalhout something to keep an eye out for, but I think interacting this with the already-implemented dec argument should be sufficient.

@jangorecki
Copy link
Member

this seems to be duplicate of #1636

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

No branches or pull requests

6 participants