| from_to | R Documentation | 
from_to - Add the next speaker as the from variable in a to/from
network data structure.  Assumes that the flow of discourse is coming from
person A to person B, or at the very least the talk is taken up by person B.
Works by taking the vector of speakers and shifting everything down one and
then adding a closing element.
from_to_summarize - A wrapper for from_to.data.frame that
adds a word.count column and then combines duplicate rows.
from_to(x, ...)
## Default S3 method:
from_to(x, final = "End", ...)
## S3 method for class 'character'
from_to(x, final = "End", ...)
## S3 method for class 'factor'
from_to(x, final = "End", ...)
## S3 method for class 'numeric'
from_to(x, final = "End", ...)
## S3 method for class 'data.frame'
from_to(x, from.var, final = "End", ...)
from_to_summarize(x, from.var, id.vars = NULL, text.var = TRUE, ...)
| x | A data form  | 
| final | The name of the closing element or node. | 
| from.var | A character string naming the column to be considered the origin of the talk. | 
| id.vars | The variables that correspond to the speaker or are attributes of the speaker (from variable). | 
| text.var | The name of the text variable.  If  | 
| ... | Ignored. | 
Returns a vector (if given a vector) or an augmented
data.table.
from_to(DATA, 'person')
from_to_summarize(DATA, 'person')
from_to_summarize(DATA, 'person', c('sex', 'adult'))
## Not run: 
if (!require("pacman")) install.packages("pacman"); library(pacman)
p_load(dplyr, geomnet, qdap, stringi, scales)
p_load_current_gh('trinker/textsahpe')
dat <- from_to_summarize(DATA, 'person', c('sex', 'adult')) %>%
    mutate(words = rescale(word.count, c(.5, 1.5)))
dat %>%
    ggplot(aes(from_id = from, to_id = to)) +
        geom_net(
            aes(linewidth = words),
            layout.alg = "fruchtermanreingold",
            directed = TRUE,
            labelon = TRUE,
            size = 1,
            labelcolour = 'black',
            ecolour = "grey70",
            arrowsize = 1,
            curvature = .1
        ) +
        theme_net() +
        xlim(c(-0.05, 1.05))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.