Learn R Programming

quanteda (version 0.9.9-65)

bootstrap_dfm: bootstrap a dfm

Description

Create an array of resampled dfms.

Usage

bootstrap_dfm(x, n = 10, ..., verbose = quanteda_options("verbose"))

Arguments

x

a character or corpus object

n

number of resamples

...

additional arguments passed to dfm

verbose

if TRUE print status messages

Value

A named list of dfm objects, where the first, dfm_0, is the dfm from the original texts, and subsequent elements are the sentence-resampled dfms.

Details

This code loops the creation of a dfm from a corpus, keeping a constant set of features based on the original dfm. Resampling of the corpus is done at the sentence level, within document.

Examples

Run this code
# NOT RUN {
txt <- c(textone = "This is a sentence.  Another sentence.  Yet another.", 
         texttwo = "Premiere phrase.  Deuxieme phrase.")
bootstrap_dfm(txt, n = 3)         
# }

Run the code above in your browser using DataLab