kwic: Extract Key Words in Context

Description Usage Arguments Details Value References See Also Examples

Description

Extract key words in context (kwic) utilizing freq_terms.

Usage

1
2
3
4
5
6
kwic(text.var, grouping.var, n.before = 1, tot = FALSE,
  n.after = n.before, ord.inds = TRUE, markup = c("<<", ">>"), top = 15,
  at.least = 5, extend = TRUE, ignore.case = FALSE, left = "\\b",
  right = "", names = c("KeyWords"), elim.old = FALSE,
  stopwords = c("going", qdapDictionaries::contractions[[1]],
  qdapDictionaries::Top200Words), ...)

Arguments

text.var

The text variable.

grouping.var

The grouping variables. Also takes a single grouping variable or a list of 1 or more grouping variables.

n.before

The number of rows before the indexed occurrence.

tot

logical. If TRUE condenses sub-units (e.g., sentences) into turns of talk for that grouping.var.

n.after

The number of rows after the indexed occurrence.

ord.inds

logical. If TRUE inds is ordered least to greatest.

markup

A character vector of length two indicating the left (element 1) and right (element 2) boundary markers to use to highlight the key words. Use c("", "") to not mark the discourse connectors.

top

Top number of terms to show.

at.least

An integer indicating at least how many letters a word must be to be included in the output.

extend

logical. If TRUE the top argument is extended to any word that has the same frequency as the top word.

ignore.case

logical. If TRUE leading character's case is ignored.

left

The left boundary (regular expression) to put on the left side of words. Default is word boundary (i.e., \\b) that cuts off at non-word characters.

right

The right boundary (regular expression) to put on the right side of words. Default is no boundary and will locate words within words. For example the expression "\\blast" will find "last" and "lastly" but not "blast". To capture precisely key words use right = "\\b" or right = left.

names

A string indicating the name of the key words in the collective group name for the key words for use in the termco and generic plot (dispersion_plot) functions.

elim.old

logical. If TRUE eliminates the columns that are combined together by the named match.list.

stopwords

A character vector of words to remove from the text.

...

Other arguments passed to termco.

Details

While kwic does not analyze discourse connectors, it is useful in identifying themes (and distribution across time) and builds upon the modular use of functions in the pkgdiscon package.

Value

Returns returns a list of 2-3:

counts

A termco object of discourse connector counts.

Context 1

A trans_context object of the key words in context. Note the name of this object is supplied by names element one.

Context 2...n

An optional (not returned if regex is of length one) trans_context object of the key words in context. Note the name of this (these) object(s) is supplied by names element 2...n.

References

Ryan, G. W. & Bernard, H. R. (2003). Techniques to identify themes. Field Methods. 15(1), 85-109. doi: 10.1177/1525822X02239569

See Also

termco, trans_context, freq_terms

Examples

1
2
3
4
5
6
7
8
out <- with(pres_debates2012, kwic(dialogue, list(time, person)))
plot(out[[1]])
head(out[[2]])
with(pres_debates2012, plot(out, grouping.var = person, rm.vars = time,
    total.color = NULL))

## Save externally use .doc or .txt
## print(out[[2]], file="kwic.doc")

trinker/discon documentation built on May 31, 2019, 8:42 p.m.