forked from quanteda/quanteda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap_dfm.Rd
46 lines (42 loc) · 1.33 KB
/
bootstrap_dfm.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
36
37
38
39
40
41
42
43
44
45
46
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bootstrap_dfm.R
\name{bootstrap_dfm}
\alias{bootstrap_dfm}
\title{Bootstrap a dfm}
\usage{
bootstrap_dfm(x, n = 10, ..., verbose = quanteda_options("verbose"))
}
\arguments{
\item{x}{a character or \link{corpus} object}
\item{n}{number of resamples}
\item{...}{additional arguments passed to \code{\link{dfm}}}
\item{verbose}{if \code{TRUE} print status messages}
}
\value{
A named list of \link{dfm} objects, where the first, \code{dfm_0}, is
the dfm from the original texts, and subsequent elements are the
sentence-resampled dfms.
}
\description{
Create an array of resampled dfms.
}
\details{
Function produces multiple, resampled \link{dfm} objects, based on
resampling sentences (with replacement) from each document, recombining
these into new "documents" and computing a dfm for each. Resampling of
sentences is done strictly within document, so that every resampled
document will contain at least some of its original tokens.
}
\examples{
# bootstrapping from the original text
set.seed(10)
txt <- c(textone = "This is a sentence. Another sentence. Yet another.",
texttwo = "Premiere phrase. Deuxieme phrase.")
bootstrap_dfm(txt, n = 3, verbose = TRUE)
}
\author{
Kenneth Benoit
}
\keyword{bootstrap}
\keyword{dfm}
\keyword{experimental}