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
#> 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 40           1 0.822 Our proud principal practicing his Latin dance … https:…
#>  2 44           1 0.796 This year, my boys and I tapped into the Hispan… https:…
#>  3 20           1 0.784 #DiaDeLosMuertos #DayOfTheDead #LatinCulture #C… https:…
#>  4 21           1 0.784 #DiaDeLosMuertos #DayOfTheDead #LatinCulture #C… https:…
#>  5 73           1 0.784 Happy Halloween from all of us at #HHM! Post a … https:…
#>  6 28           1 0.778 Celebrating #HispanicHeritageMonth at BMCC with… https:…
#>  7 96           1 0.738 Don't forget to join us @CGLA_Chatt #hispaniche… https:…
#>  8 90           1 0.656 Celebrate Halloween & #DiadeMuertos with our LI… https:…
#>  9 26           1 0.635 For Hispanic Heritage Month this year, leadersh… https:…
#> 10 22           1 0.622 Beautiful words from #DreamSpeaker Breanna Zwar… https:…
#> # ℹ 20 more rows