as.tibble | R Documentation |
Turn partition into tibble.
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"))
.Object |
An object the method is defined for. |
... |
Further arguments. |
p_attribute |
A positional attribute / p-attribute. |
mc |
Number of cores to use. |
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.