View nhanes-flexdashboard.Rmd
This file contains 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: "How does your BMI measure up?" | |
output: flexdashboard::flex_dashboard | |
runtime: shiny | |
--- | |
Inputs {.sidebar} | |
------------------------------------- | |
```{r} |
View gist:4369771
This file contains 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
# Make the canvas | |
plot(1:10,1:10,xlim=c(-5,5),ylim=c(0,10),type="n",xlab="",ylab="",xaxt="n",yaxt="n") | |
# Make the branches | |
rect(-1,0,1,2,col="tan3",border="tan4",lwd=3) | |
polygon(c(-5,0,5),c(2,4,2),col="palegreen3",border="palegreen4",lwd=3) | |
polygon(c(-4,0,4),c(3.5,5.5,3.5),col="palegreen4",border="palegreen3",lwd=3) | |
polygon(c(-3,0,3),c(5,6.5,5),col="palegreen3",border="palegreen4",lwd=3) | |
polygon(c(-2,0,2),c(6.25,7.5,6.25),col="palegreen4",border="palegreen3",lwd=3) |
View gist:4177366
This file contains 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
pvaluesPain = c(0.02, 0.06, 0.75, 0.38, 0.3, 0.07, 0.22, 0.27) | |
adjustedPvaluesPain = p.adjust(pvaluesPain,method="bonferroni") | |
adjustedPvaluesPain | |
sum(adjustedPvaluesPain < 0.05) | |
pvaluesNoPain = c(0.82, 0.98, 0.65, 0.39, 0.88, 0.95, 0.29, 0.64, 0.81) | |
adjustedPvaluesNoPain = p.adjust(pvaluesNoPain,method="bonferroni") | |
adjustedPvaluesNoPain | |
sum(adjustedPvaluesNoPain < 0.05) |
View google-scraper.R
This file contains 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
## Load libraries | |
library(XML) | |
library(dplyr) | |
library(RCurl) | |
## Get the results for a specific term | |
scrape_term = function(search_term,npages){ | |
base_url = "http://scholar.google.com/scholar?" | |
search_string = paste0("q=",paste0(strsplit(search_term," ")[[1]],collapse="+")) | |
dat = data.frame(NA,nrow=10*npages,ncol=3) |
View plots-for-postpi.R
This file contains 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(hextri) | |
library(tidyr) | |
noco = readRDS("/cloud/project/postpi/noco.rds") | |
truth = readRDS("/cloud/project/postpi/truth.rds") | |
par = readRDS("/cloud/project/postpi/par_postpi.rds") | |
nonpar = readRDS("/cloud/project/postpi/nonpar_postpi.rds") | |
nbins = 20 |
View simple-example.R
This file contains 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
### Let's simulate some data very simply | |
## Load libraries | |
library(ggplot2) | |
library(dplyr) | |
library(gam) | |
library(patchwork) | |
# Set parameters | |
n_sample = 100 |
View close.Rmd
This file contains 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: "Tabset Column" | |
runtime: shiny | |
output: flexdashboard::flex_dashboard | |
--- | |
```{r setup, include=FALSE} | |
library(flexdashboard) |
View plot_net.R
This file contains 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(ggnet) | |
#library(RkittleBrewer) | |
#library(network) | |
plot_net = function(nodes_per_layer, | |
layer_shape, | |
connection_type, | |
stride_length, | |
layer_color, | |
node_values, |
View forsean.R
This file contains 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
plot_net = function(nodes_per_layer, layer_shape, connection_type, stride_length){ | |
total_nodes = sum(nodes_per_layer) | |
adjacency = matrix(0,nrow=total_nodes,ncol=total_nodes) | |
for(i in seq_along(connection_type)){ | |
source_nodes = 1:nodes_per_layer[i] + (i-1 > 0)*sum(nodes_per_layer[1:(i-1)]) | |
sink_nodes = 1:nodes_per_layer[(i+1)] + (i > 0)*sum(nodes_per_layer[1:i]) | |
nsource = length(source_nodes) |
View jhudsl.R
This file contains 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(png) | |
library(ggforce) | |
library(animation) | |
library(tweenr) | |
jhu_png = readPNG("jhudsl.png") | |
x = rep(1:510,each=555) | |
y = rep(1:555,510) | |
val = jhu_png[,,3] | |
val = round(val) |
NewerOlder