Skip to contents

Inspect or change MAP.

Usage

px_map(x, value)

# S3 method for class 'px'
px_map(x, value)

Arguments

x

A px object

value

Optional. A character string to set the value for all languages or a data frame with columns 'language' and 'value' to set it for specific languages. If 'value' is missing, the current MAP is returned. If NULL, MAP is removed.

Value

A px object, a character string, or a data frame.

Examples

# Set MAP for all languages
x1 <-
  px(population_gl) |>
  px_map('Great Britain')

# Print MAP
px_map(x1)
#> [1] "Great Britain"

# Set MAP for individual languages
library(tibble)
x2 <-
  x1 |>
  px_languages(c('en', 'kl')) |>
  px_map(tribble(~language, ~value,
                      'en', 'Great Britain',
                      'kl', 'Kalaallit Nunaat'))
px_map(x2)
#> # A tibble: 2 × 2
#>   language value           
#>   <chr>    <chr>           
#> 1 en       Great Britain   
#> 2 kl       Kalaallit Nunaat

# Remove MAP
x3 <- px_map(x2, NULL)
px_map(x3)
#> NULL