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
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<meta name="generator" content="pandoc" /> |
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: "Intro to health data analysis in R" | |
output: html_notebook | |
--- | |
## Background | |
Today we want to demonstrate how R can provide a one-stop-shop for health data analysis. | |
We'll start with base R today, and show how [dplyr](https://cran.rstudio.com/web/packages/dplyr/vignettes/introduction.html) makes life easier. |
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
removeCommasInNumber <- function(column) { | |
column <- as.numeric(gsub(",", "", column)) | |
column | |
} | |
createChoropleth <- function(df, | |
colToPlot, | |
title, | |
legend, | |
numColors=1, |
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(ggthemes) | |
library(scales) | |
# Grab data from here: https://data.stackexchange.com/stackoverflow/query/596780/language-trends-questions-per-tag-per-month | |
# setwd() <-- You may need this | |
df <- read.csv('LanguageComparisonOverTime.csv') | |
str(df) |
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
<!doctype HTML> | |
<meta charset = 'utf-8'> | |
<html> | |
<head> | |
<script src='//d3js.org/d3.v3.min.js' type='text/javascript'></script> | |
<script src='//dimplejs.org/dist/dimple.v2.1.0.min.js' type='text/javascript'></script> | |
<style> | |
.rChart { |
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
<!doctype HTML> | |
<meta charset = 'utf-8'> | |
<html> | |
<head> | |
<script src='//d3js.org/d3.v3.min.js' type='text/javascript'></script> | |
<script src='//dimplejs.org/dist/dimple.v2.1.0.min.js' type='text/javascript'></script> | |
<style> | |
.rChart { |