look_for(iris)
# Look for a single keyword.
look_for(iris, "petal")
look_for(iris, "s")
iris %>% look_for_and_select("s") %>% head()
# Look for with a regular expression
look_for(iris, "petal|species")
look_for(iris, "s$")
# Look for with several keywords
look_for(iris, "pet", "sp")
look_for(iris, "pet", "sp", "width")
look_for(iris, "Pet", "sp", "width", ignore.case = FALSE)
# Look_for can search within factor levels or value labels
look_for(iris, "vers")
# Quicker search without variable details
look_for(iris, details = "none")
# To obtain more details about each variable
look_for(iris, details = "full")
# To deactivate default printing, convert to tibble
look_for(iris, details = "full") %>%
dplyr::as_tibble()
# To convert named lists into character vectors
look_for(iris) %>% convert_list_columns_to_character()
# Long format with one row per factor and per value label
look_for(iris) %>% lookfor_to_long_format()
# Both functions can be combined
look_for(iris) %>%
lookfor_to_long_format() %>%
convert_list_columns_to_character()
# Labelled data
d <- dplyr::tibble(
region = labelled_spss(
c(1, 2, 1, 9, 2, 3),
c(north = 1, south = 2, center = 3, missing = 9),
na_values = 9,
label = "Region of the respondent"
),
sex = labelled(
c("f", "f", "m", "m", "m", "f"),
c(female = "f", male = "m"),
label = "Sex of the respondent"
)
)
look_for(d)
d %>%
look_for() %>%
lookfor_to_long_format() %>%
convert_list_columns_to_character()
Run the code above in your browser using DataLab