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
ascvd_estimator = reactive({ | |
female.risk <- 1.0 / (1.0 + exp( - ( | |
-12.823110 + | |
0.106501 * as.numeric(input$age) + | |
0.432440 * as.numeric(input$black) + | |
0.000056 * (as.numeric(input$sysbp) ^ 2) + | |
0.017666 * as.numeric(input$sysbp) + | |
0.731678 * as.numeric(input$rxbp) + | |
0.943970 * as.numeric(input$dm) + | |
1.009790 * as.numeric(input$cursmoke) + |
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
# Data frame for which genes to include by disease | |
excl <- data.frame('gene' = c(NA), 'round' = c(NA)) | |
# Remove 30% of genes each round | |
while(nrow(excl) < nrow(d.qn)) { | |
cat('Running with', excl.n, 'genes excluded...\n') | |
# Run SVM | |
svm.model <- svm(t(as.matrix(d.qn[-excl$gene,])), # features, minus excluded genes | |
tc, # class of each sample |
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
# Create a refernce distribution using the median of all samples | |
ref <- apply(apply(data.normalized[,3:ncol(data.normalized)], | |
2, | |
FUN=sort), | |
1, | |
FUN=median) | |
# Create a emperical cdf function for the reference distribution | |
ref.cdf <- ecdf(ref) | |
# Quintile normalize! |
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(ggplot2) | |
library(maps) | |
library(mapproj) | |
# Thanks to Ernesto at Quantified Self | |
# http://quantifiedself.com/2014/03/map-moves-data/ | |
# This is set up take data from the "Tracks" export, using: | |
# https://labs.traqs.me/moves/ |
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(ggplot2) | |
library(grid) | |
ggplot(data, aes(x=x, y=y)) + | |
geom_point() + | |
# geom_line() + | |
ylab('y label') + | |
xlab('x label') + | |
theme_bw() + | |
scale_color_manual(values = c('#023F8A', '#BF4D28')) + |
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 Airports | |
# This comes from: http://openflights.org/data.html | |
airports <- read.csv('airports.dat', header=F); | |
colnames(airports) <- c('id', 'name', 'city', 'county', 'faa', 'icao', 'lat', 'lng', 'alt', 'timezone', 'dst') | |
airports$faa <- as.character(airports$faa) | |
# Load trips | |
# a file with: "source-airport,destination-airport,date" | |
# e.g., "MSP,SFO,2014-01-01" | |
trips <- read.csv('trips.csv', header=F); |
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 Airports | |
# This comes from: http://openflights.org/data.html | |
airports <- read.csv('airports.dat', header=F); | |
colnames(airports) <- c('id', 'name', 'city', 'county', 'faa', 'icao', 'lat', 'lng', 'alt', 'timezone', 'dst') | |
airports$faa <- as.character(airports$faa) | |
# Load trips | |
# a file with: "source-airport,destination-airport,date" | |
# e.g., "MSP,SFO,2014-01-01" | |
trips <- read.csv('trips.csv', header=F); |
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(ggplot2) | |
library(maps) | |
library(mapproj) | |
############################################################################### | |
# Step 1: Get data from Foursquare | |
# If you already have it, then great :) Otherwise, you can use RPI. The source | |
# is listed below, and there are instructions for getting keys in the readme. | |
# RPI: https://github.com/johnschrom/RPI |
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
install.packages(file_name_and_path, repos = NULL, type="source") |
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
RewriteCond %{REMOTE_HOST} IP-ADDRESS | |
RewriteRule .* "http://www.google.com" [R=301,L] |