chron_as_sf()
adds a simple features geometry column (see sf::st_sf) to
chronological data from XRONOS, using the latitude and longitude columns.
chron_drop_na_coords()
excludes rows with missing or invalid coordinates;
it is implicitly called by chron_as_sf()
, issuing a warning if any rows
were removed.
chron_as_sf(x, crs = sf::st_crs(4326))
chron_drop_na_coords(x, .warn = FALSE)
data.frame retrieved with chron_data()
.
Desired coordinate reference system in a format understood by
sf::st_crs()
. Defaults to latitude/longitude on the WGS84 ellipsoid
(EPSG:4326).
If TRUE
, issues a warning when rows are removed.
chron_as_sf()
returns x
converted into an sf
object. The original
coordinate columns are retained.
chron_drop_na_coords()
returns x
without rows with missing or invalid
coordinates.
x <- chron_data(country = "Switzerland")
chron_as_sf(x)
#> Warning: 2213 rows with missing or invalid coordinates were removed.
#> Simple feature collection with 6422 features and 20 fields
#> Geometry type: POINT
#> Dimension: XY
#> Bounding box: xmin: 6.14182 ymin: 45.96543 xmax: 10.38184 ymax: 47.753
#> Geodetic CRS: WGS 84
#> # A tibble: 6,422 × 21
#> id labnr bp std source_database lab_name material feature_type site
#> * <dbl> <chr> <dbl> <dbl> <chr> <chr> <chr> <chr> <chr>
#> 1 5204 ETH-1… 4370 70 "" "" charcoal rockshelter Alp …
#> 2 5204 ETH-1… 4370 70 "" "" charcoal rockshelter Alp …
#> 3 5205 ETH-1… 4365 65 "" "" charcoal rockshelter Alp …
#> 4 5205 ETH-1… 4365 65 "" "" charcoal rockshelter Alp …
#> 5 5206 ETH-1… 4720 60 "" "" charcoal rockshelter Alp …
#> 6 5206 ETH-1… 4720 60 "" "" charcoal rockshelter Alp …
#> 7 5207 ARC-1… 4490 55 "" "" charcoal rockshelter Alp …
#> 8 5207 ARC-1… 4490 55 "" "" charcoal rockshelter Alp …
#> 9 5208 B-4703 4430 40 "" "" charcoal rockshelter Alp …
#> 10 5208 B-4703 4430 40 "" "" charcoal rockshelter Alp …
#> # ℹ 6,412 more rows
#> # ℹ 12 more variables: country <chr>, site_type <chr>, periods <list>,
#> # typochronological_units <list>, ecochronological_units <list>,
#> # reference <list>, species <chr>, lat <chr>, lng <chr>, feature <chr>,
#> # delta_c13 <dbl>, geometry <POINT [°]>