Created
March 3, 2021 08:53
-
-
Save verajosemanuel/0dfc0c6ea54ed8e49a3f64e51a1b2561 to your computer and use it in GitHub Desktop.
#stack a #list of #dataframes from #files with #filename in #R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
documents <- list.files("data/txt", full.names = T) | |
# using purr | |
words <- data_frame(file = documents) %>% mutate(text = map(file, read_lines)) %>% unnest() | |
# using old-skool apply | |
words2 <- data_frame(file = documents) %>% mutate(text = lapply(file, read_lines)) %>% unnest() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment