Skip to content

Instantly share code, notes, and snippets.

View jlopezper's full-sized avatar

Jorge López Pérez jlopezper

View GitHub Profile
# install.packages("devtools")
devtools::install_github("ropenspain/opendataes")
library(opendataes)
determine_number <- function(x) {
check_read <- function(data) !all(names(data) %in% c('name', 'format', "URL"))
has_url_col <- vapply(x[[2]], check_read, logical(1))
number_of_reads <- sum(has_url_col)
runs <- 100000
threshold <- 1000
Res = vector(mode = "numeric")
for (k in 1:runs){
i <- 1
v <- vector(mode = "numeric")
while (sum(v) < threshold) {
v[i] <- runif(1,0,1000)
@jlopezper
jlopezper / library_visits.R
Last active July 25, 2018 23:07
Using CKANR API with OpenDataBCN
# Load libraries
library(ckanr)
library(XML)
library(ggmap)
library(dplyr)
# API Setup
ckanr_setup(url = "http://opendata-ajuntament.barcelona.cat/data")