covars_make: compute text-based variables from text or snippet data

Description Usage Arguments Details Value

View source: R/covars_make.R

Description

Compute additional variables to snippet data created by snippets_make(). These are based on tokens, types, and various readability measures.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
covars_make(x, ...)

## S3 method for class 'snippet'
covars_make(x, ...)

## S3 method for class 'data.frame'
covars_make(x, text_field = "text", ...)

## S3 method for class 'corpus'
covars_make(x, ...)

## S3 method for class 'character'
covars_make(x, readability_measure = NULL, normalize = TRUE, ...)

covars_make_all(x, ..., dependency = TRUE, verbose = FALSE)

Arguments

x

snippet data from snippets_make() consisting of the fields text, docID, and snippetID

...

arguments passed through to covars_make_character

text_field

the name of the text field, if a data.frame, default is "text"

readability_measure

additional readability measures passed through in the measure argument passed to quanteda.textstats::textstat_readability. Because our standard input will be constituent elements rather than indexes, this defaults to NULL indicating that no compound measures will be used.

normalize

if TRUE, return proportions of words/sentences as appropriate, instead of raw counts

dependency

logical; if TRUE parse dependencies

verbose

logical; if TRUE print status messages

Details

covars_make_all calls covars_make, covars_make_baselines(), and covars_make_pos(), returning them as a data.frame.

Value

the data.frame of snippets x with added variables. Note:

W_wl.Dale.Chall is the proportion of words not in the Dale-Chall word list.


kbenoit/sophistication documentation built on May 12, 2021, 5:57 a.m.