make_location_data_list: Make a list of data and corresponding locations

View source: R/make_location_data_list.R

make_location_data_listR Documentation

Make a list of data and corresponding locations

Description

This function converts data and location into lists of sf objects using as_sf_list. If location_col, data_col, or col (which sets both to the same value), are provided the col is passed to as_sf_list to allow the creation of an sf list from a sf data frame using dplyr::group_nest().

Usage

make_location_data_list(
  data = NULL,
  location = NULL,
  key = c("location", "data"),
  ...
)

Arguments

data, location

A sf object or list of sf objects with data and corresponding locations.

key

Names for location and data in the returned list.

...

Pass location_col and/or data_col to group and nest the data provided to location and data. Use col to set both to the same value.

Details

If location and data are the same length are the same length, they are combined into a single list. If either one is length 1 when the other is not, the length 1 object is repeated to match the length of the longer object. Different length objects where neither are length 1 gives a warning.


elipousson/overedge documentation built on Aug. 13, 2022, 7:41 p.m.