Erik Brole
Erik Brole

Reputation: 365

Is there any additional installation needed for textstat_frequency() command?

I try to run this command:

dftextstat <- textstat_frequency(myDfm)

However I receive this error:

Error in textstat_frequency(myDfm) : 
  could not find function "textstat_frequency"

I installed the quanteda and spicyr packages

Upvotes: 1

Views: 56

Answers (1)

Quinten
Quinten

Reputation: 41523

The textstat_frequency is in the quanteda.textstats package. Here is a reproducible example:

library(quanteda)
#> Package version: 3.2.3
#> Unicode version: 14.0
#> ICU version: 70.1
#> Parallel computing: 8 of 8 threads used.
#> See https://quanteda.io for tutorials and examples.
library(quanteda.textstats)
myDfm <- dfm(c("a a b b c d", "a d d d", "a a a"))
#> Warning: 'dfm.character()' is deprecated. Use 'tokens()' first.
dftextstat <- textstat_frequency(myDfm)
dftextstat
#>   feature frequency rank docfreq group
#> 1       a         6    1       3   all
#> 2       d         4    2       2   all
#> 3       b         2    3       1   all
#> 4       c         1    4       1   all

Created on 2022-10-15 with reprex v2.0.2

Upvotes: 2

Related Questions