duration: Duration of Turns of Talk

Description Usage Arguments Value Examples

View source: R/duration.R

Description

duration - Calculate duration (start and end times) for duration of turns of talk measured in words.

startss - Calculate start times from a numeric vector.

ends - Calculate end times from a numeric vector.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
duration(x, ...)

## Default S3 method:
duration(x, grouping.var = NULL, ...)

## S3 method for class 'data.frame'
duration(x, text.var = TRUE, ...)

## S3 method for class 'numeric'
duration(x, ...)

starts(x, ...)

ends(x, ...)

Arguments

x

A data.frame or character vector with a text variable or a numeric vector.

grouping.var

The grouping variables. Default NULL generates one word list for all text. Also takes a single grouping variable or a list of 1 or more grouping variables.

text.var

The name of the text variable. If TRUE duration tries to detect the text column.

...

Ignored.

Value

Returns a vector or data frame of starts and/or ends.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(x <- c(
    "Mr. Brown comes! He says hello. i give him coffee.",
    "I'll go at 5 p. m. eastern time.  Or somewhere in between!",
    "go there"
))
duration(x)
group <- c("A", "B", "A")
duration(x, group)

groups <- list(group1 = c("A", "B", "A"), group2 = c("red", "red", "green"))
duration(x, groups)

data(DATA)
duration(DATA)

## Larger data set
duration(hamlet)

## Integer values
x <- sample(1:10, 10)
duration(x)
starts(x)
ends(x)

textshape documentation built on May 29, 2021, 1:07 a.m.