code_bundesland {ags}R Documentation

Convert the Name or the AGS of a Bundesland

Description

Convert the Name or the AGS of a Bundesland

Usage

code_bundesland(
  sourcevar,
  origin = "ags",
  destination = "name",
  factor = FALSE
)

Arguments

sourcevar

Vector which contains the codes or names to be converted.

origin

The following options are available:

  • ags: AGS (default).

  • name: Bundesland name.

destination

The following options are available:

  • ags: Bundesland AGS (default).

  • iso: The Bundesland two-character abbreviation.

  • name: Bundesland name.

  • name_eng: Bundesland name in English.

factor

If TRUE returns ordered factor.

Details

This function converts a string of Bundesland names into the AGS, the standardized (English) name, or the Bundesland abbreviation.

If origin="AGS", the first two digits will be used to identify a Bundesland. It is therefore important that sourcevar is supplied as a character vector with a leading zeros if applicable.

Value

A character vector.

See Also

format_ags() for formatting AGS.

Examples

library(dplyr)
data(btw_sn)

btw_sn %>% 
 mutate(bl=code_bundesland(district, origin="ags", 
     destination="name"))


[Package ags version 1.0.1 Index]