Learn R Programming

ndl (version 0.2.18)

cueCoding: code a vector of cues as n-grams

Description

cueCoding codes a vector of cues into unigrams, bigrams, …, n-grams, with unigrams as default.

Usage

cueCoding(cues = c("hello", "world"), maxn=1, adjacent=FALSE)

Arguments

cues

A vector of cues (represented by strings) to be recoded as unigrams, bigrams, …, ngrams.

maxn

The longest n-gram to be encoded, by default maxn=1.

adjacent

A logical indicating whether only adjacent bigrams should be included when maxn=2. If adjacent=TRUE and maxn!=2, maxn is forced to 2.

Value

A vector of cue n-grams, one for each word in the input vector cues. Each n-gram vector lists the constituent unigrams, bigrams, etc., separated by underscores.

References

Arppe, A. and Baayen, R. H. (in prep.). Statistical classification and principles of human learning.

See Also

See also ndlClassify, ndlCuesOutcomes, ndlVarimp, ndlCrossvalidate.

Examples

Run this code
# NOT RUN {
# Cues from the \code{think} data: Person, Number, Register
cues <- c("First", "Plural", "hs95")
cueCoding(cues, maxn=1)
cueCoding(cues, maxn=2)
# }

Run the code above in your browser using DataLab