This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# download the Dockerfile | |
wget https://gist.githubusercontent.com/a-paxton/f7d6ddbddd02468372e6fdbccac1436a/raw/c314f625b65e13e25989d68877f938230d52d017/Dockerfile | |
# build the container | |
docker build -t pac-data_analysis_container . | |
# start the container | |
docker run --name pac-data_analysis -p 8787:8787 -v $(pwd):/home/rstudio/foobar -e GRANT_SUDO=yes -d pac-data_analysis_container |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM rocker/rstudio:latest | |
RUN R -e "install.packages('plyr', repos = 'http://cran.us.r-project.org')" | |
RUN R -e "install.packages('dplyr', repos = 'http://cran.us.r-project.org')" | |
RUN R -e "install.packages('stringr', repos = 'http://cran.us.r-project.org')" | |
RUN R -e "install.packages('data.table', repos = 'http://cran.us.r-project.org')" | |
RUN R -e "install.packages('lme4', repos = 'http://cran.us.r-project.org')" | |
RUN R -e "install.packages('ggplot2', repos = 'http://cran.us.r-project.org')" | |
RUN R -e "install.packages('pander', repos = 'http://cran.us.r-project.org')" | |
RUN R -e "install.packages('gridExtra', repos = 'http://cran.us.r-project.org')" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d3 = function() { | |
var d3 = { | |
version: "3.2.7" | |
}; | |
if (!Date.now) Date.now = function() { | |
return +new Date(); | |
}; | |
var d3_document = document, d3_documentElement = d3_document.documentElement, d3_window = window; | |
try { | |
d3_document.createElement("div").style.setProperty("opacity", 0, ""); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d3 = function() { | |
var d3 = { | |
version: "3.2.7" | |
}; | |
if (!Date.now) Date.now = function() { | |
return +new Date(); | |
}; | |
var d3_document = document, d3_documentElement = d3_document.documentElement, d3_window = window; | |
try { | |
d3_document.createElement("div").style.setProperty("opacity", 0, ""); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Convert the output of a topicmodels Latent Dirichlet Allocation to JSON | |
#' for use with LDAvis | |
#' | |
#' @param fitted Output from a topicmodels \code{LDA} model. | |
#' @param corpus Corpus object used to create the document term | |
#' matrix for the \code{LDA} model. This should have been create with | |
#' the tm package's \code{Corpus} function. | |
#' @param doc_term The document term matrix used in the \code{LDA} | |
#' model. This should have been created with the tm package's | |
#' \code{DocumentTermMatrix} function. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# preliminaries | |
from pymongo import MongoClient | |
from nltk.corpus import stopwords | |
from string import ascii_lowercase | |
import pandas as pd | |
import gensim, os, re, pymongo, itertools, nltk, snowballstemmer | |
# set the location where we'll save our model | |
savefolder = '/data' |