Skip to content

Instantly share code, notes, and snippets.

@dylanjm
Created December 5, 2018 04:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dylanjm/ef2fde50ee2fae94e0c7d7f255f24066 to your computer and use it in GitHub Desktop.
Save dylanjm/ef2fde50ee2fae94e0c7d7f255f24066 to your computer and use it in GitHub Desktop.
library(tidyverse)
read_lines(here::here("input_data/data04a.txt")) %>%
str_match("\\[(\\d+)-(\\d+-\\d+) (\\d+):(\\d+)\\] (.*$)") %>%
as_tibble() %>%
set_names(c("raw_data", "year", "date", "hour", "min", "comment")) %>%
mutate(id = str_extract_all(comment, "(\\d+)", simplify = T) %>%
ifelse(. == "", NA, .)) %>%
arrange(year, date, hour, min) %>%
fill(id) %>%
View()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment