Checks if the TSV file contains any non-header rows.
Usage
tsv_is_empty(
x,
comment = "##",
col_types = readr::cols(.default = "c"),
n_max = 1,
...
)
Arguments
- x
Path to TSV file.
- comment
Taken from
readr::read_tsv()
.- col_types
Taken from
readr::read_tsv()
.- n_max
Taken from
readr::read_tsv()
.- ...
Other arguments to be passed to
readr::read_tsv()
.
Examples
tmp1 <- tempfile()
writeLines(c("col1\tcol2\tcol3", "1\t2\t3"), con = tmp1)
(a <- tsv_is_empty(tmp1))
#> [1] FALSE
tmp2 <- tempfile()
writeLines(c("col1\tcol2\tcol3"), con = tmp2)
(b <- tsv_is_empty(tmp2))
#> /tmp/Rtmp5lfwP1/file17525e690fa0 does not contain any non-header rows.
#> [1] TRUE
tmp3 <- tempfile()
writeLines(c("##meta1", "##meta2", "col1\tcol2\tcol3"), con = tmp3)
(c <- tsv_is_empty(tmp3))
#> /tmp/Rtmp5lfwP1/file17521ee78a0d does not contain any non-header rows.
#> [1] TRUE