Skip to content

read_delim converts "." to "0" #297

@katwre

Description

@katwre

The problem is that "." is parsed as a number like ".0", and as a result it returns "0". That's why adding locale = locale(decimal_mark = ",", grouping_mark = "_") to read_delim helps. Here is an example:

> file = "chr1\t1\t10\t.\t15\t20\nchr1\t5\t15\t.\t20\t25"
> read_delim(file, delim="\t", col_names=F)
    X1 X2 X3 X4 X5 X6
1 chr1  1 10  0 15 20
2 chr1  5 15  0 20 25

Apart of that it converts "+" and "-" to NA or "0" and that I just do not understand, e.g:

> file = "chr1\t1\t10\t+\t15\t20\nchr1\t5\t15\t-\t20\t25"
> read_delim(file, delim="\t", col_names=F)
Warning: 1 parsing failure.
row col expected actual
  1  X4 a number       
    X1 X2 X3 X4 X5 X6
1 chr1  1 10 NA 15 20
2 chr1  5 15  0 20 25

Metadata

Metadata

Assignees

Labels

bugan unexpected problem or unintended behavior

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions