cas_kwic | R Documentation |
Adds a column with n words before and after the selected pattern to see keywords in context
cas_kwic(
corpus,
pattern,
text = text,
words_before = 5,
words_after = 5,
same_sentence = TRUE,
period_at_end_of_sentence = TRUE,
ignore_case = TRUE,
regex = TRUE,
full_words_only = FALSE,
full_word_with_partial_match = TRUE,
pattern_column_name = pattern
)
corpus |
A textual corpus as a data frame. |
pattern |
A pattern, typically of one or more words, to be used to break text. Should be of length 1 or length equal to the number of rows. |
text |
Defaults to text. The unquoted name of the column of the corpus data frame to be used for matching. |
words_before |
Integer, defaults to 5. Number of columns to include in
the |
words_after |
Integer, defaults to 5. Number of columns to include in
the |
same_sentence |
Logical, defaults to TRUE. If TRUE, before and after include only words found in the sentence including the matched pattern. |
period_at_end_of_sentence |
Logical, defaults to TRUE. If TRUE, a period
(".") is always included at the end of a sentence. Relevant only if
|
ignore_case |
Defaults to TRUE. |
regex |
Defaults to TRUE. Treat pattern as regex. |
full_words_only |
Defaults to FALSE. If FALSE, pattern is counted even when it is found in the middle of a word (e.g. if FALSE, "ratio" would be counted as match in the word "irrational"). |
full_word_with_partial_match |
Defaults to TRUE. If TRUE, if there is a
partial match of the pattern, the |
pattern_column_name |
Defaults to 'pattern'. The unquoted name of the column to be used for the word in the output. |
A data frame (a tibble), with the same columns as input, plus three columns: before, pattern, and after. Only rows where the pattern is found are included.
cas_kwic(
corpus = tifkremlinen::kremlin_en,
pattern = c("china", "india")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.