Checks the number of rows in data.

check_rows(
  data,
  min_row = 1,
  max_row = max_nrow(),
  data_name = substitute(data)
)

Arguments

data

The data frame to check.

min_row

A count of the minimum number of rows.

max_row

A count of the maximum number of rows.

data_name

A string of the name of data.

Value

Throws an informative error or returns an invisible copy of data.

Details

By default (min_row = 1) data must include at least one row.

Examples

try(check_rows(data.frame()))
#> Error : data.frame() must have at least 1 row
try(check_rows(data.frame(x = 1), 2))
#> Error : data.frame(x = 1) must have at least 2 rows