forked from quanteda/quanteda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdfm_sort.Rd
35 lines (33 loc) · 960 Bytes
/
dfm_sort.Rd
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
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/dfm_sort.R
\name{dfm_sort}
\alias{dfm_sort}
\title{Sort a dfm by frequency of one or more margins}
\usage{
dfm_sort(x, decreasing = TRUE, margin = c("features", "documents",
"both"))
}
\arguments{
\item{x}{Document-feature matrix created by \code{\link{dfm}}}
\item{decreasing}{logical; if \code{TRUE}, the sort will be in descending
order, otherwise sort in increasing order}
\item{margin}{which margin to sort on \code{features} to sort by frequency of
features, \code{documents} to sort by total feature counts in documents,
and \code{both} to sort by both}
}
\value{
A sorted \link{dfm} matrix object
}
\description{
Sorts a \link{dfm} by descending frequency of total features, total features
in documents, or both.
}
\examples{
dfmat <- dfm(data_corpus_inaugural)
head(dfmat)
head(dfm_sort(dfmat))
head(dfm_sort(dfmat, decreasing = FALSE, "both"))
}
\author{
Ken Benoit
}