as.tibble: Turn partition into tibble.

as.tibbleR Documentation

Turn partition into tibble.

Description

Turn partition into tibble.

Usage

as.tibble(.Object, ...)

## S4 method for signature 'partition'
as.tibble(.Object, p_attribute)

## S4 method for signature 'partition_bundle'
as.tibble(.Object, p_attribute, mc = getOption("polmineR.mc"))

Arguments

.Object

An object the method is defined for.

...

Further arguments.

p_attribute

A positional attribute / p-attribute.

mc

Number of cores to use.

Examples

## Not run: 
library(polmineR)
library(tibble)
library(plyr)
library(dplyr)
library(pbapply)

plprbt <- partition("PLPRBT", speaker_type = "speech", speaker_year = "2010")
speeches <- as.speeches(
  plprbt,
  sAttributeDates = "speaker_date", sAttributeNames = "speaker_name", gap = 500,
  mc = TRUE, progress = TRUE
)
for (i in rev(which(summary(speeches)[["token"]] == 0))) speeches@objects[[i]] <- NULL
tib <- as.tibble(speeches, p_attribute = "word")
Y <- ddply(
  .data = tib,
  .variable = .(speaker_type, speaker_date, speaker_name, partition_name),
  .fun = function(x) paste(x[["word"]], collapse = " "),
  .progress = "text"
  )
colnames(Y)[5] <- "fulltext"

## End(Not run)

PolMine/polmineR.misc documentation built on Nov. 23, 2022, 9:01 p.m.