Closed
Description
openedon Jul 30, 2021
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")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment