This file contains hidden or 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
# making the random sample reproducible, makes it easier to take other samples | |
set.seed(123) | |
# add your local path below | |
setwd("") | |
fulldat <- read.csv("fulldat.csv", header = TRUE) | |
#removing duplicates | |
fulldat <- fulldat[!duplicated(fulldat$var),] | |
str(fulldat) |
This file contains hidden or 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
<snippet> | |
<content><![CDATA[ | |
```{r setup, include = FALSE} | |
library(reports); library(slidify); library(knitcitations); library(knitr) | |
opts_chunk$set(cache = FALSE) | |
BIB <- system.file("extdata/docs/example.bib", package = "reports") | |
bib <- read.bibtex(BIB) | |
``` | |
]]></content> | |
<!-- Optional: Set a tabTrigger to define how to trigger the snippet --> |
This file contains hidden or 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
# setting working directory | |
setwd("~/Desktop") | |
# calling packages, need to install packages with install.packages if you haven't installed them before | |
library(ggplot2) | |
library(lubridate) | |
#------------------------------------------------------------------------------ | |
# importing data |
This file contains hidden or 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
@prefix rdfs: <http://www.w3.org/rdf/schema/#> . | |
@prefix ex: <http://example.org/> . | |
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | |
ex:Methane | |
rdfs:label "methane"^^xsd:string ; | |
ex:formula "CH4"^^xsd:string ; | |
ex:carbonCount "1"^^xsd:integer . | |
ex:Ethane | |
rdfs:label "ethane"^^xsd:string ; |
This file contains hidden or 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
# script below from http://goo.gl/OwjblF | |
# install.packages("rrdf") | |
require(rrdf) | |
#------------------------------------------------------------------------------ | |
# creating store | |
ontStore = new.rdf() |
This file contains hidden or 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
# code from http://goo.gl/DSb9XY | |
install.packages("WDI") | |
library(ggplot2) | |
library(WDI) | |
DF <- WDI(country=c("US","CA","MX"), indicator="NY.GDP.MKTP.KD.ZG", start=1990, end=2008) | |
ggplot(DF, aes(year, NY.GDP.MKTP.KD.ZG, color=country))+geom_line(stat="identity")+theme_bw()+xlab("Year")+opts(title="Annual GDP Growth rate (%)")+ylab("") |
This file contains hidden or 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
# Tab completion | |
a<Tab> # first car and hit tab | |
# Instropection | |
a = 'Foo says hello' | |
a? # shows info about variable, docstrings if it is function/instance method | |
aa?? # shows source code | |
# Unix Commands | |
!git # normal git command inside Ipython. Most of the Unix commands can be used this way |
This file contains hidden or 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
Country | Level | Units | As Of | ~5Y Ago | ~10Y Ago | ~25Y Ago | |
---|---|---|---|---|---|---|---|
Afghanistan | 16.26% | percent | 2005 | 9.62% | |||
Laos | 12.46% | percent | 2011 | 16.95% | 20.00% | ||
Latvia | 2.13% | percent | 2010 | 2.85% | 1.97% | ||
Lebanon | 9.22% | percent | 2011 | 9.16% | |||
Lesotho | 20.01% | percent | 2010 | 20.95% | 19.62% | 23.68% | |
Kyrgyzstan | 0.07% | percent | 2011 | 0.08% | 0.16% | ||
Libya | 9.58% | percent | 1983 | 14.73% | |||
Lithuania | 0.53% | percent | 2010 | 0.62% | 0.66% | ||
Luxembourg | 0.00% | percent | 2010 | 4.40% | 6.14% |
This file contains hidden or 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
Quandl.auth("") # add your token, which you have to get at http://www.quandl.com/users/edit | |
library(devtools) | |
install_github('R-package','quandl') | |
require(Quandl) | |
require(ggplot2) | |
require(RCurl) | |
data <- getURL("https://gist.github.com/rpietro/6665635/raw/edb700cc7b2110c3f7dd4d559221f351e17369fd/ed.csv") | |
ed <- read.csv(data) | |
head(ed) |
This file contains hidden or 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
Literacy rate, youth total (% of people ages 15-24) | |
School enrolment, preprimary, national source (% gross) | |
Gross intake ratio in grade 1, total, national source (% of relevant age group) | |
Gender parity index for gross intake ratio in grade 1 | |
Rate of out of school children, national source (% of relevant age group) | |
Primary completion rate, total, national source (% of relevant age group) | |
Gender parity index for primary completion rate | |
Progression to secondary school, national source (%) | |
Lower secondary completion rate, total, national source (% of relevant age group) | |
Lower secondary education, classrooms, national source |