Skip to content

version 2.0.0: na argument of read_tsv() does allow empty cells to be parsed with no missing values/NAs #1255

@pfreese

Description

@pfreese

The na argument of readr::read_tsv() and related functions does not properly allow for a cell between two consecutive tabs ("\t\t") to be parsed as "" instead of NA.

df_w_empty_cell <- data.frame(name = c("ben", ""),
                              age = c(5, 10),
                              stringsAsFactors = FALSE)
# .tsv has contents:
# name  age
# ben   5
#       10
tsv_file <- "/tmp/df_w_empty_cell.tsv"
readr::write_tsv(df_w_empty_cell, tsv_file)

# > df_loaded
# A tibble: 2 x 2
# name    age
# <chr> <dbl>
# ben       5
# NA       10     <- This NA should be "".
df_loaded <- readr::read_tsv(tsv_file,
                             na = "NA")

Metadata

Metadata

Assignees

No one assigned

    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