Skip to contents

Example posts for each topic

Usage

exemplars_segmentr(lda, orig_data, n_posts = 10)

Arguments

lda

The LDA object made with fit_LDAs or par_fit_LDAs

orig_data

Data object which was originally used

n_posts

How many examples posts per topic should be selected

Value

List of data frames of exemplar posts

Examples


seg_ldas <- SegmentR:::test_data(explore = FALSE)$lda
#> removing stopwords
#> Making DTMs
#> making tuning grid
#> setting up LDAs
data <- seg_ldas$data
seg_ldas <- seg_ldas$lda
exemplars <- purrr::map2(
  seg_ldas, 
  data,
  SegmentR::exemplars_segmentr
)
exemplars[[1]]
#> # A tibble: 30 × 5
#>    document topic gamma message                                          url_var
#>    <chr>    <int> <dbl> <chr>                                            <chr>  
#>  1 69           1 0.905 Fun ones #HispanicHeritageMonth pinterest.com/p… https:…
#>  2 20           1 0.843 #DiaDeLosMuertos #DayOfTheDead #LatinCulture #C… https:…
#>  3 80           1 0.792 Wake Up Texas! #VETOBETO. Beto wrong Texas!      https:…
#>  4 21           1 0.784 #DiaDeLosMuertos #DayOfTheDead #LatinCulture #C… https:…
#>  5 87           1 0.771 #halloween #cna #cnasofinstagram #tampanurses #… https:…
#>  6 100          1 0.708 Kilgore ISD's Hispanic Heritage Fest draws hund… https:…
#>  7 42           1 0.688 #DiaDeLosMuertos #DayOfTheDead #LatinCulture #C… https:…
#>  8 46           1 0.688 #DiaDeLosMuertos #DayOfTheDead #LatinCulture #C… https:…
#>  9 95           1 0.633 Latinas community, come support children educat… https:…
#> 10 74           1 0.598 Stop LatinX Resource Fair 11 A.M. 1 P.M. MBSC A… https:…
#> # ℹ 20 more rows