Skip to content

Instantly share code, notes, and snippets.

View MariaBattle's full-sized avatar
💭
Active

Maria Battle MariaBattle

💭
Active
View GitHub Profile
@stephenturner
stephenturner / explore-correlations.r
Created August 27, 2012 22:06
Exploring correlations with R using cor.prob and chart.Correlation
## Correlation matrix with p-values. See http://goo.gl/nahmV for documentation of this function
cor.prob <- function (X, dfr = nrow(X) - 2) {
R <- cor(X, use="pairwise.complete.obs")
above <- row(R) < col(R)
r2 <- R[above]^2
Fstat <- r2 * dfr/(1 - r2)
R[above] <- 1 - pf(Fstat, 1, dfr)
R[row(R) == col(R)] <- NA
R
}
@vankesteren
vankesteren / lantaarnpaal_utrecht.R
Last active June 29, 2019 05:24
Creating a map with all the lampposts in Utrecht
library(tidyverse)
lights_dat <- read_csv("https://ckan.dataplatform.nl/dataset/83402c68-1c05-4aa5-ab28-2e99d2bc2261/resource/dc10e0ac-351a-49b6-b3db-d0152c29dc02/download/paal-20180906.csv")
pp <-
lights_dat %>%
filter(latitude > 50) %>%
ggplot(aes(x = longitude, y = latitude)) +
geom_point(alpha = 0.03, fill = "#FAFAAB", stroke = 0, pch = 21, size = 1.6) +
geom_point(alpha = 0.8, fill = "#FAFAAB", stroke = 0, pch = 21, size = 0.2) +