Skip to content

Instantly share code, notes, and snippets.

@erichare
Created August 26, 2019 18:42
Show Gist options
  • Save erichare/43c01bb3467d0ce3711068b1a236cb8e to your computer and use it in GitHub Desktop.
Save erichare/43c01bb3467d0ce3711068b1a236cb8e to your computer and use it in GitHub Desktop.
clean.R
library(tidyverse)
library(clean)
unclean_tbl <- tibble(
Logical = c("Yes", "No", "Depends", "Unknown"),
Factor = c("bachelor's", "Bachelor's Degree", "Master's Degree", "PhD"),
Currency = c("$20", "$ 25", "26.02", "$27.0"),
Numeric = c("~15", "about 10", "20", "15")
)
clean_tbl <- unclean_tbl %>%
mutate(
Logical = clean_logical(Logical),
Factor = clean_factor(Factor, levels = c("Bachelor's", "Master's", "PhD")),
Currency = clean_currency(Currency),
Numeric = clean_numeric(Numeric)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment