Skip to content

read.csv treat column as character instead of number if missing value after valid value #42

@comicfans

Description

@comicfans

read following csv

col1,col2
,1
2,

with

csv <-read.csv('test.csv',stringsAsFactors=F)
typeof(csv$col1)
csv$col1
typeof(csv$col2)
csv$col2

GNU-R

integer
NA 2
integer
1 NA

fastR

integer
NA 2
character
"1"  ""

seems this only happen if missing value after valid value. for example add more row like this:

col1,col2
,1
2,
,3

fastR typeof col1 will also changed to character

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions