KTMJS Talk by @prabhasp
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
get_dk_reason <- function(df) { | |
dk <- names(df)[str_detect(names(df), "dont")] | |
llply(df[dk], function(x) { as.character(na.exclude(x)) }) | |
} | |
plot_percent_dks <- function(dk_list, N) { | |
# d will be a list of question name and length | |
d <- ldply(dk_list, length) | |
# order the data frame | |
d <- arrange(d, V1) | |
# divide by N (which is supposed to be total responses |
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
<link href="http://kevinburke.bitbucket.org/markdowncss/markdown.css" rel="stylesheet"> | |
Finding indicator dependencies | |
======================================================== | |
I had been meaning to look into R's metaprogramming features for a while now. I finally had a chance today (thanks [Hadley](http://adv-r.had.co.nz/)!), and I used it to experiment towards a problem that had been in the back of my mind for a while: finding depencies within indicator definitions. | |
Below, I implement a find dependencies function, which takes a set of indicators, and finds dependencies within it. Indicators are fields within a dataset, some of which are already there, and some of which are newly created. The dependency finding problem is investigating which new indicators derive from which existing ones. We think of these relationships as dependencies: for an indicator such as pupil-to-teacher-ratio (defined as the number-of-pupils divided by the number-of-teachers), pupil-to-teacher-ratio is dependent on number-of-pupils |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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> | |
<head> | |
<title>Foo</title> | |
<meta charset='utf-8' /> | |
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' /> | |
<style type='text/css'> | |
body { | |
background:#000; | |
color:#fff; |
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
We'll be checking whether the top 100 users of formhub follow a power law distribution, or a log-normal distribution, using guidance from [a blog post by CMU stats prof. Cosma Rohilla Shaliz](http://vserver1.cscs.lsa.umich.edu/~crshalizi/weblog/857.html). | |
First, load up the dataset; I have included it here in case you want to re-produce it. Each value is a number of submissions on formhub for top 100 users. | |
```{r} | |
source("~/Downloads/pli-R-v0.0.3-2007-07-25/pareto.R") | |
source("~/Downloads/pli-R-v0.0.3-2007-07-25/lnorm.R") | |
source("~/Downloads/pli-R-v0.0.3-2007-07-25/power-law-test.R") | |
users <- c(220346L, 31099L, 28568L, 16573L, 14862L, 7531L, 6510L, 6138L, |
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
setwd("~/Dropbox/FINAL CONPEDIUM OF LOCALITIES/") | |
require(gdata) | |
l <- list.files() | |
l <- l[which(str_detect(l, "\\.xls"))] | |
listofdfs <- llply(l, function(fname) { | |
print(paste("Reading file:", fname)) | |
tryCatch({ | |
d <- read.xls(fname) |
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
<p><link href="http://kevinburke.bitbucket.org/markdowncss/markdown.css" rel="stylesheet"></link></p> | |
Analyzing bamboo bechmarks--2013/3/13 | |
===================================== | |
Please refer to the generating index.Rmd file if you want to look at the code that generated this file. It should be in the same folder as index.html (which you are seeing now); most R code will be hidden for prettiness. | |
```{r warning=FALSE, message=FALSE, echo=FALSE} | |
library(lubridate) | |
library(reshape2) | |
library(ggplot2) | |
library(plyr) | |
# Read in data |
[ Launch: pnc-schedules ] 5795197 by prabhasp
OlderNewer