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
--- | |
title: "MOMA" | |
author: "VP Nagraj" | |
date: "February 29, 2016" | |
output: html_document | |
runtime: shiny | |
--- | |
The Museum of Modern Art (MOMA) collection database is publicly available via Github: |
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
# first install mailR. It is a bit funky to install this because of the dependency on rJava | |
#First install java | |
### sudo add-apt-repository ppa:webupd8team/java | |
### sudo apt-get update | |
### sudo apt-get install oracle-java8-installer | |
#now you can install mailR. The assumption is that java is in /usr/lib/jvm/jdk1.8.0_66/. Check if a newer version has changed the directory | |
sudo JAVA_HOME=/usr/lib/jvm/jdk1.8.0_66/ R CMD javareconf | |
sudo JAVA_HOME=/usr/lib/jvm/jdk1.8.0_66/ Rscript -e 'install.packages(c("mailR"), .Library.site[1], repos="http://cran.us.r-project.org", dependencies=TRUE)' |
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
{ | |
"AWSEBDockerrunVersion": "1", | |
"Image": { | |
"Name": "<AWS_ACCOUNT_ID>.dkr.ecr.us-east-1.amazonaws.com/<NAME>:<TAG>", | |
"Update": "true" | |
}, | |
"Ports": [ | |
{ | |
"ContainerPort": "443" | |
} |
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
# This function reads a Rmd file and returns the word count | |
# It uses the wordcountaddin and koRpus packages | |
text_stats_file <- function(rmdFile) { | |
rmd <- file(rmdFile, "rt") | |
text <- readLines(rmd) | |
conText <- "" | |
for (i in text) { | |
conText <- paste(conText, i) | |
} | |
close(rmd) |
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
# Example Dockerfile | |
FROM hello-world |
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 r-base:latest | |
COPY . /usr/local/src/myscripts | |
WORKDIR /usr/local/src/myscripts | |
CMD ["Rscript", "myscript.R"] |
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
library(doParallel) | |
rpts <- list(list(out="one.html", params=list(some_var="One")), | |
list(out="two.html", params=list(some_var="Two")), | |
list(out="three.html", params=list(some_var="Three")), | |
list(out="four.html", params=list(some_var="Four"))) | |
do_rpt <- function(r) { | |
require(rmarkdown) |
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
#' Email a user a report is ready | |
#' | |
#' Requires an account at Mailgun: https://mailgun.com | |
#' Pre-verification can only send to a whitelist of emails you configure | |
#' | |
#' @param email Email to send to | |
#' @param mail_message Any extra info | |
#' | |
#' @return TRUE if successful email sent | |
#' @import httr |
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
**** Web Server (UI) | |
ShinyProxy | |
https://github.com/openanalytics/shinyproxy | |
https://github.com/openanalytics/shinyproxy-demo | |
http://www.shinyproxy.io/ | |
Modularizing Shiny app code - http://shiny.rstudio.com/articles/modules.html | |
http://stackoverflow.com/questions/25306519/shiny-saving-url-state-subpages-and-tabs |
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
library(shiny) | |
options(shiny.reactlog=TRUE) | |
# define home dir for shiny app | |
homed <- getwd() | |
# set up choices to be retrievable in server.R | |
progchoices <- c("This is a TEST APP" = "testapp/", | |
"Yet Another Program" = "anotherprog/") | |
ui <- fluidPage( |