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
# Objective | |
# | |
# Fit a gamma distribution knowing that: | |
# - 20% fall below 15 days | |
# - 80% fall below 60 days | |
# Inspired by http://www.johndcook.com/blog/2010/01/31/parameters-from-percentiles/ | |
x <- c(0.2, 0.8) | |
y <- c(15, 60) |
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
#!/bin/bash | |
areas_de_ponderacao="ftp://geoftp.ibge.gov.br/malhas_digitais/censo_2010/areas_de_ponderacao/" | |
setores_censitarios="ftp://geoftp.ibge.gov.br/malhas_digitais/censo_2010/setores_censitarios/" | |
setores_censitarios_kmz="ftp://geoftp.ibge.gov.br/malhas_digitais/censo_2010/setores_censitarios_kmz/" | |
CNEFE="ftp://ftp.ibge.gov.br/Censos/Censo_Demografico_2010/Cadastro_Nacional_de_Enderecos_Fins_Estatisticos/" | |
date=`date +%F` | |
mkdir $date |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- | |
## SOURCE: xe.com | |
--> | |
<currency-symbol count="115"> | |
<entry code="ALL" unicode-decimal="76, 101, 107" unicode-hex="4c, 65, 6b">Albania Lek</entry> | |
<entry code="AFN" unicode-decimal="1547" unicode-hex="60b">Afghanistan Afghani</entry> | |
<entry code="ARS" unicode-decimal="36" unicode-hex="24">Argentina Peso</entry> | |
<entry code="AWG" unicode-decimal="402" unicode-hex="192">Aruba Guilder</entry> | |
<entry code="AUD" unicode-decimal="36" unicode-hex="24">Australia Dollar</entry> |
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
# ggplot2 example | |
# Show how geom_line() does not connect the line through NA values | |
library(ggplot2) | |
# Make some fake data | |
mydata <- data.frame(x = 2000:2010, y = rnorm(11, 5, 2)) | |
# First plot, all lines are connected correctly | |
ggplot(mydata, aes(x, y)) + geom_line() |
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
# animation-2.r | |
# author: Bryce Mecum ([email protected]) | |
# | |
# Animations in R Tutorial | |
# Part 2 of 6 | |
# | |
# Extend part 1 by plotting a random (uniform) walk starting in the bottom | |
# right-hand corner and moving North and West. | |
library(maps) |
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(dplyr) | |
# Set up an example data frame | |
stations = c("A", "B", "C") | |
species = c("M", "N", "O", "P", "Q") | |
baseline = c(5, 50, 500) | |
n <- 25 | |
mydf <- data.frame(station=sample(stations, n, replace=TRUE), species=sample(species, n, replace=TRUE)) | |
mydf$baseline <- baseline[match(mydf$station, stations)] |
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
################ | |
# Setup | |
################ | |
rm(list=(ls())) | |
#libs | |
library(reshape2) | |
library(plyr) | |
library(stringr) |
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
# Archigos transitions and tenure by regime type | |
# | |
# Andreas Beger | |
# 15 December 2014 | |
setwd("~/Desktop/archigos-polity") | |
library(foreign) | |
library(gdata) |
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
# run a quick demonstration | |
install.packages("Hmisc",dependencies=TRUE) | |
update.packages() | |
library("Hmisc") | |
mydata<-spss.get("http://www.rci.rutgers.edu/~rwomack/R/vermont.sav",use.value.labels=TRUE) | |
head(mydata) | |
tail(mydata) | |
summary(mydata) | |
attach(mydata) | |
hist(AGEP) |
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
# devtools::install_github("duncantl/ROAuth") | |
# devtools::install_github("karthik/rDrop") | |
library(ROAuth) | |
library(rDrop) | |
load('my_dropbox_credentials.rdata') #credentials object from rDrop instructions | |
shinyServer(function(input, output) { | |
output$Main <- renderUI({ | |
dynamicUi() |