| detect_header | R Documentation |
Given a raw table read with no header (every cell character), scores
each of the first rows with a 7-signal weighted heuristic (alphabetic ratio,
non-numeric ratio, uniqueness, normalized Shannon entropy, median string
length, alpha-vs-next-row transition, fill completeness) and returns the
most header-like row plus repaired, unique column names. Empty cells
are upward-filled (merged-cell repair) and any still-empty name becomes
col_<j>. Base + stats only; no file-format dependencies.
detect_header(raw, verbose = FALSE)
raw |
A data.frame or matrix of the raw sheet, read with
|
verbose |
Logical; emit the chosen row via |
A list with header_row (integer), score (numeric),
names (repaired character vector, length == ncol(raw)),
and all_scores.
read_data()
raw <- data.frame(
V1 = c("age", "34", "51"),
V2 = c("sex", "M", "F"),
V3 = c("score", "8.1", "7.4"),
stringsAsFactors = FALSE
)
detect_header(raw)$names
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.