tidy_list(list(p=1:500, r=letters))
tidy_list(list(p=mtcars, r=mtcars, z=mtcars, d=mtcars))
x <- list(
a = setNames(c(1:4), LETTERS[1:4]),
b = setNames(c(7:9), LETTERS[7:9]),
c = setNames(c(10:15), LETTERS[10:15]),
d = c(x=4, y=6, 4),
e = setNames(1:10, sample(state.abb, 10, TRUE)),
f = setNames(1:10, sample(month.abb, 10, TRUE))
)
tidy_list(x)
if (FALSE) {
## 2015 Vice-Presidential Debates Example
if (!require("pacman")) install.packages("pacman")
pacman::p_load(rvest, magrittr, xml2)
debates <- c(
wisconsin = "110908",
boulder = "110906",
california = "110756",
ohio = "110489"
)
lapply(debates, function(x){
paste0("http://www.presidency.ucsb.edu/ws/index.php?pid=", x) %>%
xml2::read_html() %>%
rvest::html_nodes("p") %>%
rvest::html_text() %>%
textshape::split_index(grep("^[A-Z]+:", .)) %>%
textshape::combine() %>%
textshape::split_transcript() %>%
textshape::split_sentence()
}) %>%
textshape::tidy_list("location")
}
Run the code above in your browser using DataLab