whe_lexdiv: Lexical diversity

Description Usage Arguments Value Examples

Description

Calculate the lexical diversity or complexity of text.

Usage

1
2
3
4
5
6
7
whe_lexdiv(wh, measure = "R")

## S3 method for class 'data.frame'
whe_lexdiv(wh, measure = "R")

## S3 method for class 'character'
whe_lexdiv(wh, measure = "R")

Arguments

wh

highlighted object returned by wh_collect, see examples.

measure

lexical diversity type to compute, passed to textstat_lexdiv.

Value

if data.frame is passed will append a column named lexdiv, boolean. If character vector is passed the function returns a boolean vector.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
library(webhose)
token <- wh_token("xXX-x0X0xX0X-00X")

token %>%
  wh_news(q = '"R programming"') %>%
  wh_collect() -> rstats # collect results

rstats %>%
  whe_lexdiv() -> lexdiv

library(dplyr)

rstats %>%
  mutate(lexdiv = whe_lexdiv(text)) # pass text column

## End(Not run)

news-r/webhoserx documentation built on June 10, 2019, 12:27 a.m.