Skip to content

Instantly share code, notes, and snippets.

View stnorton's full-sized avatar

Sean Norton stnorton

View GitHub Profile
@stnorton
stnorton / R2MALLET.r
Created November 14, 2019 20:16 — forked from benmarwick/R2MALLET.r
R code to operate MALLET entirely from within R. Set variables, send commands to Windows' command console and get MALLET's result back into R for further analysis.
# Set working directory
dir <- "C:\\" # adjust to suit
setwd(dir)
# configure variables and filenames for MALLET
## here using MALLET's built-in example data and
## variables from http://programminghistorian.org/lessons/topic-modeling-and-mallet
# folder containing txt files for MALLET to work on
importdir <- "C:\\mallet-2.0.7\\sample-data\\web\\en"