View source: R/colcomb2class.R
colcomb2class | R Documentation |
Combine columns from qdap classes or a data.frame
.
colcomb2class(
dataframe,
combined.columns,
class = "list",
percent = TRUE,
digits = 2,
elim.old = TRUE,
zero.replace = 0,
override = FALSE
)
dataframe |
A dataframe or qdap class (e.g.,
|
combined.columns |
A list of named vectors of the colnames/indexes of the numeric columns to be combined (summed). If a vector is unnamed a name will be assigned. |
class |
The class to assign to the output. |
percent |
logical. If |
digits |
Integer; number of decimal places to round when printing. |
elim.old |
logical. If |
zero.replace |
Value to replace 0 values with. |
override |
logical. If |
Returns a list with raw counts, percents and combined raw and percents.
## Not run:
## `termco` example
ml <- list(
cat1 = c(" the ", " a ", " an "),
cat2 = c(" I'" ),
"good",
the = c("the", " the ", " the", "the")
)
dat1 <- with(raj.act.1, termco(dialogue, person, ml))
colcomb2class(dat1, list(cats = c("cat1", "cat2")))
## `question_type` example
dat2 <- question_type(DATA.SPLIT$state, DATA.SPLIT$person)
combs <- list(
`wh/how` = c("what", "how"),
oth = c("shall", "implied_do/does/did")
)
colcomb2class(dat2, combs)
## `pos_by` example
dat3 <- with(DATA, pos_by(state, list(adult, sex)))
colcomb2class(dat3, qcv(DT, EX, FW))
## data.frame example
dat4 <- data.frame(X=LETTERS[1:5], matrix(sample(0:5, 20, TRUE), ncol = 4))
colcomb2class(dat4, list(new = c("X1", "X4")))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.