| add_item_prod_code | R Documentation |
Add a new column to an existing tibble with the corresponding code for each production item name. The codes are assumed to be from those defined by FAOSTAT.
add_item_prod_code(
table,
name_column = "item_prod_name",
code_column = "item_prod_code"
)
table |
The table that will be modified with a new column. |
name_column |
The name of the column in |
code_column |
The name of the output column containing the codes. |
A tibble with all the contents of table and an extra column
named code_column, which contains the codes. If there is no code match,
an NA is included.
table <- tibble::tibble(
item_prod_name = c("Rice", "Cabbages", "Dummy Item")
)
add_item_prod_code(table)
table |>
dplyr::rename(my_item_prod_name = item_prod_name) |>
add_item_prod_code(name_column = "my_item_prod_name")
add_item_prod_code(table, code_column = "my_custom_code")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.