Skip to content

Instantly share code, notes, and snippets.

@arbelt
Created May 15, 2020 01:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arbelt/03cf79b32feb6774718576ea4e111dd0 to your computer and use it in GitHub Desktop.
Save arbelt/03cf79b32feb6774718576ea4e111dd0 to your computer and use it in GitHub Desktop.
Example with textreg
library(textreg)
library(tm)
library(dplyr)
library(wrapr) # for dot-pipe
df_mi <- df0 %.>%
filter(., !is.na(mostimportant))
corp_mi <- df_mi %.>%
pull(., mostimportant) %.>%
VectorSource %.>%
VCorpus
corp_mi.clean <- clean.text(corp_mi)
corp_mi.stemmed <- stem.corpus(corp_mi.clean, verbose = FALSE)
textreg(corp_mi.stemmed, df_mi$experience %in% 5, verbosity = 0, C=1, gap = 1, min.pattern = 2, min.support = 4,
step.verbosity = 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment