Skip to content

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

Description

@SteveBronder

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!

Activity

  1. arunsrinivasan commented on May 26, 2016

    @arunsrinivasan
    Member

    Thanks. Many fread enhancements are planned for next release.

  2. jaapwalhout commented on May 30, 2016

    @jaapwalhout

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

  3. MichaelChirico commented on Jun 1, 2016

    @MichaelChirico
    Member

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

  4. jangorecki commented on Jun 2, 2016

    @jangorecki
    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions