lexdiv(x, ...)
"lexdiv"(x, measure = c("all", "TTR", "C", "R", "CTTR", "U", "S", "Maas"), log.base = 10, drop = TRUE, ...)
TRUE
, the result is returned as a numeric vector if
only a single measure is requested; otherwise, a data.frame is returned
with each column consisting of a requested measure.lexdiv
calculates a variety of proposed indices for lexical
diversity. In the following formulae, $N$ refers to the total number of
tokens, and $V$ to the number of types: "TTR"
:
"C"
:
"R"
:
"CTTR"
:
"U"
:
"S"
:
"K"
:
"Maas"
:
mydfm <- dfm(subset(inaugCorpus, Year > 1980), verbose = FALSE)
(results <- lexdiv(mydfm, c("CTTR", "TTR", "U")))
cor(lexdiv(mydfm, "all"))
# with different settings of drop
lexdiv(mydfm, "TTR", drop = TRUE)
lexdiv(mydfm, "TTR", drop = FALSE)
Run the code above in your browser using DataLab