Skip to content

Instantly share code, notes, and snippets.

@cigrainger
Created December 18, 2016 23:00
Show Gist options
  • Save cigrainger/5fc621687e49e21d211c7644efd5b9a8 to your computer and use it in GitHub Desktop.
Save cigrainger/5fc621687e49e21d211c7644efd5b9a8 to your computer and use it in GitHub Desktop.
data <- readLines('~/Downloads/_chat.txt')
remove <- vector(mode = 'logical', length = length(data))
for (i in 1:length(data)){
if (!str_detect(data[i], ': Christopher Grainger: |: Ebony Ruggero: ')) {
data[i-1] <- str_c(data[i-1], data[i], sep = ' ')
remove[i] <- TRUE
} else {
remove[i] <- FALSE
}
}
data <- data[!remove]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment