Compute entropies of documents or features
textstat_entropy(x, margin = c("documents", "features"), base = 2)
x | a |
---|---|
margin | character indicating for which margin to compute entropy |
base | base for logarithm function |
a data.frame of entropies for the given document or feature
textstat_entropy(data_dfm_lbgexample)#> document entropy #> 1 R1 3.386943 #> 2 R2 3.386943 #> 3 R3 3.386943 #> 4 R4 3.386943 #> 5 R5 3.386943 #> 6 V1 3.386943textstat_entropy(data_dfm_lbgexample, "features")#> feature entropy #> 1 A 0.0000000 #> 2 B 0.0000000 #> 3 C 0.0000000 #> 4 D 0.0000000 #> 5 E 0.0000000 #> 6 F 0.1686609 #> 7 G 0.1708952 #> 8 H 0.4371120 #> 9 I 0.6476138 #> 10 J 1.0338027 #> 11 K 1.4131631 #> 12 L 1.5669101 #> 13 M 1.5996467 #> 14 N 1.5656144 #> 15 O 1.5806321 #> 16 P 1.6267307 #> 17 Q 1.6414915 #> 18 R 1.6034693 #> 19 S 1.5561626 #> 20 T 1.5311306 #> 21 U 1.4979274 #> 22 V 1.3664642 #> 23 W 1.1291805 #> 24 X 1.0439334 #> 25 Y 1.0338027 #> 26 Z 1.0726302 #> 27 ZA 1.0458291 #> 28 ZB 0.7876499 #> 29 ZC 0.5357150 #> 30 ZD 0.3435197 #> 31 ZE 0.1708952 #> 32 ZF 0.1686609 #> 33 ZG 0.0000000 #> 34 ZH 0.0000000 #> 35 ZI 0.0000000 #> 36 ZJ 0.0000000 #> 37 ZK 0.0000000