textshape (version 1.7.3)

bind_list: Row Bind a List of Named Dataframes or Vectors

Description

Deprecated, use tidy_list instead.

Usage

bind_list(x, id.name = "id", content.name = "content", ...)

Value

Returns a data.table with the names

from the list as an id column.

Arguments

x

A named list of data.frames or vector.

id.name

The name to use for the column created from the list.

content.name

The name to use for the column created from the list of vectors (only used if x is vector).

...

ignored.

Examples

Run this code
if (FALSE) {
bind_list(list(p=1:500, r=letters))
bind_list(list(p=mtcars, r=mtcars, z=mtcars, d=mtcars))

## 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){
    xml2::read_html(paste0("http://www.presidency.ucsb.edu/ws/index.php?pid=", x)) %>%
        rvest::html_nodes("p") %>%
        rvest::html_text() %>%
        textshape::split_index(grep("^[A-Z]+:", .)) %>%
        textshape::combine() %>%
        textshape::split_transcript() %>%
        textshape::split_sentence()
}) %>%
    textshape::bind_list("location")
}

Run the code above in your browser using DataLab