The function characterNames() is applicable on all tables with a character table (that are of the class QDHasCharacter). It can be used to reformat the character names. The function FUN is applied to the character name entries within the QDDrama object. The factor levels in the character column of x are replaced by the result values of FUN.

characterNames(x, drama, FUN = stringr::str_to_title, sort = 0, ...)

Arguments

x

The object in which we want to transform names, needs to inherit the type QDHasCharacter.

drama

The QDDrama object with all the information.

FUN

A function applied to the strings. Defaults to stringr::str_to_title, which converts the strings to title case.

sort

Numeric. If set to a non-zero value, the resulting data.frame will be sorted alphabetically according to the drama and character name. If the value is above 0, the sorting will be ascending, if set to a negative value, the sorting is descending. If sort is set to 0 (the default), the order is unchanged. The ordering can also be specified explicitly, by passing an integer vector with as many elements as x has rows.

...

All other arguments are ignored.

Value

The function returns x, but with modified character names.

See also

str_to_title

Examples

data(rksp.0) ustat <- utteranceStatistics(rksp.0) ustat <- characterNames(ustat, rksp.0)