Skip to content

Instantly share code, notes, and snippets.

@vpnagraj
vpnagraj / eda_tools.R
Created April 9, 2024 14:17
Simple (and non-exhaustive) demo of exploratory data analysis tools in R
###############################################################################
## brief demo of exploratory data analysis (EDA) tools for data frames in R
## NOTE: the code below is intended to preview the EDA tools ...
## ... it does not exhaustively demonstrate functionality for these tools ...
## ... and it is current as of 2024-04-09 ...
## ... for more information refer to the documentation for each package
###############################################################################
###############################################################################
## set up
@vpnagraj
vpnagraj / app.R
Created November 17, 2016 17:43
skeleton of a shiny app to setwd and source R scripts
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(
@vpnagraj
vpnagraj / benchmark.R
Created July 4, 2018 15:45
benchmarking `svSocket` versus base `load` versus `redis`
library(microbenchmark)
library(redux)
library(svSocket)
# clear workspace
rm(list = ls())
# set up svSocket
startSocketServer()
con <- socketConnection(host = "localhost", port = 8888, blocking = FALSE)
@vpnagraj
vpnagraj / moma.Rmd
Created February 29, 2016 21:41
rmarkdown with embedded shiny app
---
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:
@vpnagraj
vpnagraj / scratch.R
Last active January 25, 2018 15:07
files for shiny workshop
# install.packages("babynames")
library(babynames)
# install.packages("tidyverse")
library(tidyverse)
# install.packages("ggplot2")
# install.packages("dplyr")
# let's take a look at the data
babynames %>%
View()
@vpnagraj
vpnagraj / scales.R
Created January 4, 2018 16:52
scale exploration
library(ggplot2)
library(tidyr)
dat <- data.frame(x = rnorm(n = 1000, mean = 2.8, sd = 0.05),
y1 = sample(64503:73034, size = 1000, replace = TRUE),
y2 = sample(18738:19602, size = 1000, replace = TRUE))
dat %>%
ggplot() +
geom_point(aes(x,y1)) +
@vpnagraj
vpnagraj / outbreak_animation_list.R
Created June 16, 2017 17:04
script to demonstrate outbreak animation with a subset of mers_korea_2015 data
# script to demonstrate outbreak animation with a subset of mers_korea_2015 data
# must install github release of threejs package
# devtools::install_github("bwlewis/rthreejs")
library(threejs)
library(outbreaks)
library(dplyr)
# use dplyr to subset results to only include hospital visit exposure
# script to demonstrate outbreak animation with a subset of mers_korea_2015 data
# must install github release of threejs package
# devtools::install_github("bwlewis/rthreejs")
library(threejs)
library(outbreaks)
library(dplyr)
# use dplyr to subset results to only include hospital visit exposure
# list manipulation workshop
# scratch script
# november 9 2016
#############################################
slamwins <- list(17,14,14,12,11)
#############################################
@vpnagraj
vpnagraj / panderlatexpost.Rmd
Created March 3, 2016 20:44
example of an rmarkdown document that uses latex syntax in pander table headings
---
title: "RMarkdown(Pandoc(LaTeX))"
author: "VP Nagraj"
date: "March 3, 2016"
output:
html_document:
keep_md: yes
---
```{r, warning=FALSE, message=FALSE}