duration {textshape}R Documentation

Duration of Turns of Talk

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

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

(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)

[Package textshape version 1.7.5 Index]