filter_recode | R Documentation |
Filters data based on named vectors or list of them. Filtered series can be recoded at the same time, and also columns are returned as factor with levels in order of filtering information.
filter_recode(dat, ..., query = NULL, droplevels = TRUE, check = FALSE)
dat |
A data.frame to filter and recode. |
... |
A (named) vector with a name. |
query |
A same as ... as a list. Overrides dots. |
droplevels |
A locigal to droplevels of factors. Default TRUE. |
check |
Whether to check missing levels. |
Gives message for missing filtering levels.
data.frame(tieto = c("taso kaksi", "taso kaksi", "taso yksi"), tieto2 = c("a", "b", "c")) |>
filter_recode(
tieto = c("Yksi" = "taso yksi",
"Kaksi" = "taso kaksi"),
tieto2 = c("b", "c")) |>
str()
# Puuttuvan tiedon tarkistaminen
data.frame(tieto = c("taso kaksi", "taso kaksi", "taso yksi"), tieto2 = c("a", "b", "c")) |>
filter_recode(
tieto = c("Yksi" = "taso yksi",
"Kaksi" = "taso kaksi",
"Kolme" = "taso kolme"),
tieto2 = c("a", "b", "c", "d"), check = TRUE) |>
str()
data.frame(tieto = c("taso kaksi", "taso kaksi", "taso yksi"), tieto2 = c("a", "b", "c")) |>
filter_recode(
tieto = c("Yksi" = "taso"),
tieto2 = c("a", "b", "c"), check = TRUE) |>
str()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.