tsv_is_empty: Does the TSV file contain any non-header rows?

Description Usage Arguments Value Examples

View source: R/utils.R

Description

Checks if the TSV file contains any non-header rows.

Usage

1
2
3
4
5
6
7
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().

Value

TRUE if there is at least one non-header row in the TSV, FALSE otherwise.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
tmp1 <- tempfile()
writeLines(c("col1\tcol2\tcol3", "1\t2\t3"), con = tmp1)
(a <- tsv_is_empty(tmp1))

tmp2 <- tempfile()
writeLines(c("col1\tcol2\tcol3"), con = tmp2)
(b <- tsv_is_empty(tmp2))

tmp3 <- tempfile()
writeLines(c("##meta1", "##meta2", "col1\tcol2\tcol3"), con = tmp3)
(c <- tsv_is_empty(tmp3))

umccr/gpgr documentation built on Nov. 25, 2021, 1:15 p.m.