Skip to content

Instantly share code, notes, and snippets.

View a-paxton's full-sized avatar

Alexandra Paxton a-paxton

View GitHub Profile
@a-paxton
a-paxton / jetstream-pac_container_builder
Created July 17, 2018 21:50
Jetstream init script for PAC
#!/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
@a-paxton
a-paxton / Dockerfile
Created July 17, 2018 21:46
Dockerfile for PAC
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')"
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, "");
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, "");
@a-paxton
a-paxton / topicmodels_json_ldavis.R
Last active November 15, 2015 08:43 — forked from christophergandrud/topicmodels_json_ldavis.R
Convert the output of a topicmodels Latent Dirichlet Allocation model to JSON for use with LDAvis
#' 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.
@a-paxton
a-paxton / text-cleaning+word2vec-gensim.py
Created September 11, 2015 23:31
Cleaning Text Data and Creating 'word2vec' Model with Gensim
# 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'