Every fetch – fetch_indicator(), country_data(), world_data(),
add_indicator(), and the population, deflator and PPP series that
per_capita(), deflate() and to_ppp() fetch for themselves – records
which provider each value column came from, in what unit, from which
release and when. source_info() reads that record; source_info<- writes
one for your own data, so a map of it can say where it came from too.
Value
source_info(): a tibble, one row per described column, with the
ten fields above (no rows when nothing is recorded). source_info<-: x
with the record attached.
Which verbs keep it
The record is an attribute. dplyr's filter(), mutate(), arrange(),
select() and left_join() (on the left-hand side) keep a data frame's
attributes, and summarise() drops them; the package's own verbs carry the
record explicitly, including attach_geometry(), which builds its result
from the geometry. The map verbs copy it into map_provenance(), whose
print method names the source of the fill, and footnote = "auto" adds a
one-line source note to the caption.
Examples
d <- data.frame(iso3c = c("FRA", "DEU"), rate = c(7.3, 3.1))
source_info(d) <- data.frame(column = "rate", source = "My survey",
unit = "%", fetched_at = "2026-10-01")
source_info(d)
#> # A tibble: 1 × 10
#> column source indicator label unit provider_updated fetched_at vintage
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 rate My survey NA NA % NA 2026-10-01 NA
#> # ℹ 2 more variables: licence <chr>, citation <chr>
