Description Usage Arguments Value Examples
Combine documents in a dfm by a grouping variable, which can also be
one of the docvars attached to the dfm. This is identical in
functionality to using the "groups"
argument in dfm()
.
1 |
x |
a dfm |
groups |
either: a character vector containing the names of document
variables to be used for grouping; or a factor or object that can be
coerced into a factor equal in length or rows to the number of documents.
|
fill |
logical; if |
force |
logical; if |
dfm_group
returns a dfm whose documents are equal to
the unique group combinations, and whose cell values are the sums of the
previous values summed by group. Document-level variables that have no
variation within groups are saved in docvars. Document-level
variables that are lists are dropped from grouping, even when these exhibit
no variation within groups.
Setting the fill = TRUE
offers a way to "pad" a dfm with document
groups that may not have been observed, but for which an empty document is
needed, for various reasons. If groups
is a factor of dates, for
instance, then using fill = TRUE
ensures that the new documents will
consist of one row of the dfm per date, regardless of whether any documents
previously existed with that date.
1 2 3 4 5 6 7 8 9 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.