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
#!/usr/bin/env Rscript | |
args <- commandArgs(trailingOnly = TRUE) | |
if (is.na(args[1])) { | |
cat('Missing file name\n') | |
q('no') | |
} else { | |
file <- args[1] | |
} | |
if (is.na(args[2])) { | |
cat('No port specified - defaulting to 8080\n') |
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
#setup | |
library(magick) | |
windowsFont("Roboto") | |
# inputs | |
setwd("c:/Users/steph/Dropbox/Locke Data/LoginCards/") | |
myfile <- "MiniBack.pdf" | |
n<-100 | |
# write.csv(data.frame(usernames=paste0("u",stringr::str_pad(1:n,pad = "0",width = 3)) | |
# ,pwords=random::randomStrings(n,len = 6,digits = FALSE,loweralpha = FALSE)) |
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
## Authentication | |
## This is a small app to demonstrate user-managed authentication without encoded passwords. | |
## Users are stored in a SQL database with passwords along with roles. | |
## Once a user is logged in the shiny app responds to the user's role. | |
## In order to use in a real setting, additional code for password management, | |
## changing and resetting would need to be implemented. | |
library(shiny) | |
library(RSQLite) |
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) | |
library(shinyBS) | |
library(shinydashboard) | |
library(leaflet) | |
library(ggplot2) | |
library(dplyr) | |
library(plotly) | |
library(RColorBrewer) | |
library(geojsonio) | |
library(data.table) |
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
microbenchmark:::microbenchmark(system('curl http://127.0.0.1:9123/predict?val=190')) | |
microbenchmark:::microbenchmark(system('curl http://127.0.0.1:9124/predict?val=190')) |
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 gist holds the files necessary to reproduce a minimal example of "printing" a flexdashboard using a headless browser. |
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
``` r | |
library(extrafont) | |
#> Registering fonts with R | |
# font_install('fontcm') # try this if its not working | |
suppressMessages(loadfonts()) | |
# check that the LM Roman fonts are installed with | |
"CM Roman" %in% fonts() | |
#> [1] TRUE | |
# main script ============ |
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(shinydashboard) | |
library(dplyr) | |
library(dbplyr) | |
library(purrr) | |
library(shiny) | |
library(highcharter) | |
library(DT) | |
library(htmltools) | |
# Use the `config` package to get the credentials |
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
#install required packages | |
install.packages("twitteR") | |
install.packages("RCurl") | |
install.packages("httr") | |
install.packages("devtools") | |
install.packages(toInstall, repos = "http://cran.r-project.org") | |
library(devtools) | |
#Load necessary packages | |
library(twitteR) |
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: "Insert `flextable`s into Word documents generated with `rmarkdown`" | |
author: Maxim Nazarov | |
output: | |
word_document: | |
keep_md: yes | |
html_document: | |
keep_md: yes | |
smart: false | |
--- |