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

View source: R/utils.R

tsv_is_emptyR Documentation

Does the TSV file contain any non-header rows?

Description

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().

Value

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

Examples


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 April 21, 2024, 1:16 a.m.