Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Pachamaltese pachamaltese

🎯
Focusing
Block or report user

Report or block pachamaltese

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pachamaltese
pachamaltese / index.html
Last active Jan 13, 2017
Sankey - Constitución Abierta
View index.html
<!doctype html>
<meta charset="utf-8">
<script src="http://d3plus.org/js/d3.js"></script>
<script src="http://d3plus.org/js/d3plus.js"></script>
<div id="viz"></div>
<script>
var nodes = [
@pachamaltese
pachamaltese / datos_totales.json
Last active Jan 17, 2017
Constitución Abierta - Encuentros locales versus participación en elecciones presidenciales por regiones
View datos_totales.json
[
{
"region": "Tarapacá",
"comuna": "Iquique",
"poblacion": 145881,
"encuentros": 229,
"encuentros_10000hab": 15.698,
"pcent_elas": 1.525,
"pcent_votos": 0.821,
"idh": 0.766,
@pachamaltese
pachamaltese / encuentros_participacion_metropolitana.json
Created Jan 17, 2017
Constitución Abierta - Encuentros locales versus participación en elecciones municipales de la Región Metropolitana
View encuentros_participacion_metropolitana.json
[
{
"comuna": "Santiago",
"poblacion": 139180,
"encuentros_10000hab": 69.335,
"indice_participacion": 68.6176,
"color": "#717290"
},
{
"comuna": "Cerrillos",
View banned_visas_2016.R
############
# Libraries
############
packages_cran <- c("devtools", "stringi", "data.table")
download_cran <- function(pkg){
new.pkg <- pkg[!(pkg %in% installed.packages()[, "Package"])]
if (length(new.pkg) > 0) {
install.packages(new.pkg, dependencies = TRUE)
View effect_size_mixed_models.R
# It is best to use r.squaredGLMM() function from the MuMIn package
# The original function was made by Jon Lefcheck
##############
# Dependencies
##############
libraries = c("lme4","nlme")
download_and_or_load <- function(pkg){
View gnu_nongnu_homebrew.sh
# See http://pacha.hk/2017-07-15_gnu_nongnu_homebrew.html
# XCode CLT
xcode-select --install
# Update Homebrew and add formulae
brew update
# Check for broken dependencies and/or outdated packages
brew doctor
@pachamaltese
pachamaltese / search_tweets.R
Created Aug 3, 2017
using rtweet instead of twitteR
View search_tweets.R
if (!require("pacman")) install.packages("pacman")
p_load(rtweet,jsonlite,dplyr,readr)
key = "xxx" #retrieve this from dev.twitter.com under keys and tokens
secret = "yyy" #retrieve this from dev.twitter.com under keys and tokens
twitter_token = create_token("extract_data_with_r", key, secret, cache = TRUE)
saveRDS(twitter_token, file = "twitter_token.rds")
View eda.R
# Librerias e importacion de datos
library(googlesheets)
library(dplyr)
library(tidyr)
library(lubridate)
library(ggplot2)
library(ggthemes)
library(viridis)
@pachamaltese
pachamaltese / neighbors.R
Last active Sep 13, 2017 — forked from andrewheiss/neighbors.R
Calculate which countries share a border
View neighbors.R
# Adapted from https://gist.githubusercontent.com/andrewheiss/926b9d60a26e29f6bf32/raw/a09ecbca4613381a782b93e8aeaa4132016205b7/neighbors.R
# Map libraries
# You must install geos (http://trac.osgeo.org/geos/) and
# gdal (http://www.gdal.org/) first.
# OS X: `brew install geos gdal`
# Ubuntu: sudo apt-get install libgeos-dev libgdal-dev libproj-dev
# Then install these packages from source
# install.packages(c("rgeos", "rgdal"), type="source")
@pachamaltese
pachamaltese / r_on_ubuntu_16_04.sh
Last active Aug 9, 2018
Install R on Ubuntu 16.04
View r_on_ubuntu_16_04.sh
# add CRAN to apt sources
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
printf '\n#CRAN mirror\ndeb https://cran.dcc.uchile.cl/bin/linux/ubuntu xenial/\n' | sudo tee -a /etc/apt/sources.list
# install R
sudo apt-get update
sudo apt-get install libxml2-dev libssl-dev libcurl4-gnutls-dev gfortran libopenblas-dev
sudo apt-get install r-base r-base-dev
# install common packages
You can’t perform that action at this time.