Description Usage Arguments Value See Also Examples
View source: R/trans_context.R
Print (or save to an external file) n text elements before and after indices.
1 2 3 4 5 6 7 8 9 | trans_context(
text.var,
grouping.var,
inds,
n.before = 3,
tot = TRUE,
n.after = n.before,
ord.inds = TRUE
)
|
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. |
inds |
A list of integer indices to print context for. |
n.before |
The number of rows before the indexed occurrence. |
tot |
logical. If |
n.after |
The number of rows after the indexed occurrence. |
ord.inds |
logical. If |
Returns a dataframe of the class "qdap_context" that can be printed (i.e., saved) in flexible outputs. The dataframe can be printed as a dataframe style or pretty text output. The resulting file contains n rows before and after each index of a vector of indices.
boolean_search
,
question_type
,
end_mark
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | ## Not run:
(x <- with(DATA, trans_context(state, person, inds=c(1, 4, 7, 11))))
print(x, pretty=FALSE)
print(x, double_space = FALSE)
print(x, file="foo.xlsx")
print(x, file="foo.csv")
print(x, file="foo.txt")
print(x, file="foo.txt", pretty = FALSE)
print(x, file="foo.doc")
## With `end_mark`
inds1 <- which(end_mark(DATA.SPLIT[, "state"]) == "?")
with(DATA.SPLIT, trans_context(state, person, inds=inds1))
with(DATA.SPLIT, trans_context(state, person, n.before = 0, inds=inds1))
## With `boolean_search`
inds2 <- boolean_search(DATA.SPLIT$state, " I &&.")
with(DATA.SPLIT, trans_context(state, person, inds=inds2))
inds3 <- boolean_search(DATA$state, " I ||.")
with(DATA.SPLIT, trans_context(state, person, inds=inds3))
with(DATA.SPLIT, trans_context(state, list(person, sex), inds=inds3))
with(DATA.SPLIT, trans_context(state, list(sex, adult), inds=inds3))
inds4 <- boolean_search(raj$dialogue, spaste(paste(negation.words, collapse = " || ")))
trans_context(raj$dialogue, raj$person, inds4)
### With `question_type`
(x <- question_type(DATA.SPLIT$state, DATA.SPLIT$person))
## All questions
with(DATA.SPLIT, trans_context(state, person, inds=x$inds))
## Specific question types
y <- x[["raw"]]
inds5 <- y[y[, "q.type"] %in% qcv(what, how), "n.row"]
with(DATA.SPLIT, trans_context(state, person, inds=inds5))
with(DATA.SPLIT, trans_context(state, person, inds=inds5, tot=F))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.