Skip to content

Instantly share code, notes, and snippets.

@tpaskhalis
Created August 12, 2019 16:53
Show Gist options
  • Save tpaskhalis/9fa398b7af235fdc2a3b3eab5f6c0eff to your computer and use it in GitHub Desktop.
Save tpaskhalis/9fa398b7af235fdc2a3b3eab5f6c0eff to your computer and use it in GitHub Desktop.
readtext_replacement.R
download.file("https://github.com/lse-me314/assignment09/blob/master/UKimmigTexts.zip?raw=true", destfile = "UKimmigTexts.zip")
unzip("UKimmigTexts.zip", exdir = "UKimmigTexts")
fls <- list.files("UKimmigTexts", full.names = TRUE)
txts <- character(length(fls))
for (i in seq_along(fls)) {
txts[i] <- paste(readLines(fls[i]), collapse = " ")
}
mycorpus <- quanteda::corpus(txts, docnames = fls)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment