Skip to content

Instantly share code, notes, and snippets.

@necronet
Last active June 27, 2020 21:56
Show Gist options
  • Save necronet/6978e2b79b0d0eb299d629d788e2822b to your computer and use it in GitHub Desktop.
Save necronet/6978e2b79b0d0eb299d629d788e2822b to your computer and use it in GitHub Desktop.
Quickly filtering data for PTF
library(readr)
library(skimr)
library(dplyr)
library(stringr)
data <- readr::read_csv('data.csv')
skimr::skim(data)
data_cleaned <- data %>% filter(!stringr::str_detect(Page, "@powertofly\\.com")) %>%
mutate(Registrations =
case_when(stringr::str_detect(Page, "\\?show_confirmation") ~ 1, T ~ Registrations) )
write_csv(data_cleaned, "data_cleaned.csv")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment