Read a Screaming Frog export into a normalized data frame
Source:R/screaming_frog_contract.R
sf_read_input.RdReads a Screaming Frog export – either an in-memory data frame
or a path to a CSV/Excel file – and returns it with canonical snake_case
column names, validated against the schema for export_kind. Header
aliases are resolved (e.g. "Address", "URL", and
"URI" all map to address), empty strings become NA,
and character columns are trimmed.
Arguments
- x
A data frame, or a path to a Screaming Frog CSV/Excel export.
- export_kind
Character, which export is being read. One of
sf_contract()$export_kinds:"internal_all","all_inlinks", or"all_outlinks".- fields
Optional character vector of additional (non-required) fields to retain beyond the schema's required set. Default
NULLkeeps the schema's standard field order.
Value
A data frame with canonical snake_case columns. The resolved schema
is attached as the "sf_schema" attribute, a list of
export_kind, columns, aliases, and
ignored_columns.
See also
Other Screaming Frog toolkit:
sf_container_from_path(),
sf_contract(),
sf_graph_eligible(),
sf_normalize_position(),
sf_parse_follow(),
sf_region_from_path(),
sf_rel_nofollow()
Examples
crawl <- data.frame(
Address = c("https://example.com/", "https://example.com/a"),
`Status Code` = c(200, 200),
check.names = FALSE
)
out <- sf_read_input(crawl, "internal_all")
names(out)
#> [1] "address" "status_code"
attr(out, "sf_schema")$export_kind
#> [1] "internal_all"