Skip to content

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

@SteveBronder

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!

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