Build data and AI skills | 50% off

Last chance! 50% off unlimited learning

Sale ends in


quanteda (version 0.9.9-50)

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
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