Skip to contents

Extract gamma or beta matrices for all topics

Usage

tidy_all(x, matrix = "beta", ...)

Arguments

x

tmfast object

matrix

Desired matrix, 'beta' or 'gamma'

...

Other arguments, passed to tidy.tmfast()

Value

A long dataframe, with one row per word-topic or topic-doc combination. Column names depend on the value of matrix.

Examples

# \donttest{
set.seed(42)
theta  = rdirichlet(50, 1, k = 4)
phi    = rdirichlet(4, 0.1, k = 20)
corpus = draw_corpus(rep(50L, 50), theta, phi)
model  = tmfast(corpus, n = c(3, 4))
tidy_all(model, matrix = 'beta')
#> # A tibble: 140 × 4
#>        k token topic      beta
#>    <int> <chr> <chr>     <dbl>
#>  1     3 3     V1    0.00429  
#>  2     3 3     V2    0.000538 
#>  3     3 3     V3    0.893    
#>  4     3 5     V1    0.00493  
#>  5     3 5     V2    0.00233  
#>  6     3 5     V3    0.00793  
#>  7     3 7     V1    0.406    
#>  8     3 7     V2    0.000477 
#>  9     3 7     V3    0.000877 
#> 10     3 8     V1    0.0000156
#> # ℹ 130 more rows
# }