The function applies a scheme to a data.frame or a sf object, which consists in keeping only variable that should be kept, renaming variables, and setting the type of variable.

apply_scheme(x, scheme, selection = NULL, name_origin = NULL)

Arguments

x

data.frame or sf, data to be adapted.

scheme

data.frame, scheme to be applied.

selection

list, for big scheme a way to select entries. See details

name_origin

character, when different 'name_origin' are provided, a way to select the good one.

Value

data adapted, keeping geometry for 'sf' objects.

Details

'selection' should be a named list of vector, the name giving the column where to perform the selection.

'name_origin' should be a character pattern that will help to select between different possibilities in column names starting with "name_origin" in scheme. The simplest, the best.

Author

Frédéric Grelot