detect_nonsubject_rows: Detect rows that are not subjects (totals, site headers)

View source: R/spec.r

detect_nonsubject_rowsR Documentation

Detect rows that are not subjects (totals, site headers)

Description

A row is non-subject when any identifier cell reads like a summary label (TOTAL, Sum, Osszesen with or without accent), or when the main identifier carries no digit while at least 90% of the others do (site-name header rows).

Usage

detect_nonsubject_rows(raw, spec)

Arguments

raw

Raw character data.frame.

spec

Its spec.

Value

Logical vector, TRUE for non-subject rows.

Examples

df <- data.frame(id = c(sprintf("AB%03d", 1:59), "TOTAL"), value = 1:60)
path <- file.path(tempdir(), "nonsubject_rows.csv")
utils::write.csv(df, path, row.names = FALSE, na = "")
src <- read_source(path)
spec <- infer_spec(src, id = "id")
flagged <- detect_nonsubject_rows(src$raw, spec)
src$raw[flagged, , drop = FALSE]

cellsynth documentation built on Oct. 31, 2026, 1:07 a.m.