Skip to content

Instantly share code, notes, and snippets.

View RCura's full-sized avatar

Robin Cura RCura

View GitHub Profile
library(tidyverse)
library(duckdb)
library(DBI)
# création de la BDD en mémoire
connexion <- dbConnect(drv = duckdb(), dbdir=":memory:")
# Création d'une vue correspondant au fichier (csv ici)
dbExecute(connexion, statement = "CREATE VIEW matable AS SELECT * FROM 'stations.csv'")
@RCura
RCura / download_overpass.R
Created January 25, 2021 17:26
OSM download
myQuery <- "node['natural'='tree'](50.4353,4.8307,50.4788,4.9018);out;"
myJSONQuery <- curl::curl_escape(paste("[out:json];", myQuery, sep=""))
myURL <- paste("https://overpass-api.de/api/interpreter?data=", myJSONQuery, sep = "")
myURL
rawJson <- jsonlite::fromJSON(myURL)
json_data <- rawJson %>%
purrr::pluck("elements")
sf_data <- json_data %>%
@RCura
RCura / comtes_us_2018.csv
Created May 15, 2020 15:15
Densité des Comtés US
STATEFP COUNTYFP COUNTYNS NAME NAMELSAD TOT_POP areakm2 densitekm2
31 039 00835841 Cuming Cuming County 8940 1488.3432196816361 6.006679025226661
53 069 01513275 Wahkiakum Wahkiakum County 4426 742.5452485698621 5.960579518250841
35 011 00933054 De Baca De Baca County 1781 6045.909576780487 0.2945793312622452
31 109 00835876 Lancaster Lancaster County 317272 2192.1201123408173 144.7329451583776
31 129 00835886 Nuckolls Nuckolls County 4195 1491.3637168744444 2.812861780486222
72 085 01804523 Las Piedras Las Piedras Municipio NA 87.78087137695171 NA
46 099 01265772 Minnehaha Minnehaha County 192876 2107.8901870150967 91.50192035056835
48 327 01383949 Menard Menard County 2139 2336.8517291110265 0.9153340682053918
06 091 00277310 Sierra Sierra County 2987 2491.993948322783 1.1986385448529586
BEGIN:VCALENDAR
VERSION:2.0
PRODID:Robin
X-WR-CALNAME:Horaires Marées Herbaudière 2020-2021
NAME:Horaires marées Herbaudière 2020-2021
BEGIN:VEVENT
UID:CAL-MAREES-HERBAUDIERE-00001@cura.info
DTSTAMP:20200420T200000
DTSTART:20200101
SUMMARY:BM: 02h33 (NA) / 14h56 (56)
@RCura
RCura / arts.svg
Created March 22, 2020 16:50
logos trivial pursuit
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@RCura
RCura / encadre_latex.tex
Created May 31, 2019 13:40
encadre_latex.tex
% ###### CREATION D'ENCADRES ###### %
% Encadré pris dans la thèse de Seb Rey
\usepackage[most]{tcolorbox}
\newtcbtheorem[number within=chapter]{encadre}{Encadré}{
outer arc=0pt,
arc=0pt,
breakable,
enhanced,
colback=white,
@RCura
RCura / sector-ize.R
Created October 3, 2018 09:40
sector-ize a circle
library(sf)
# Create the base circle polygon
circle <- st_geometry(st_point(c(1E6,1E6))) %>%
st_sfc(crs = 2154) %>%
st_buffer(dist = 1000)
# Create regularly spaced points around polygon
perim_points <- circle %>%
st_cast("LINESTRING") %>%
@RCura
RCura / testD3.html
Created July 26, 2018 09:11
Parcoords : rotate axis title + wrap long titles
<!DOCTYPE html>
<meta charset="utf-8">
<style>
svg {
font: 12px sans-serif;
}
.background path {
fill: none;
@RCura
RCura / exemple_histog_postgresql.R
Last active June 12, 2018 22:12
Connexion à PostgreSQL + histogramme avec ggplot2
# Connexion à la BDD PostgreSQL
library(DBI) # Package générique pour la connexion à des BDD
library("RPostgreSQL") # Package apportant les drivers pour PostgreSQL
driver <- dbDriver("PostgreSQL")
con <- DBI::dbConnect(drv = driver,
host = "ip de la BDD",
port = "port de la BDD",
@RCura
RCura / README.md
Created April 28, 2018 10:40 — forked from emeeks/README.md
circularbrush.filter

The earlier example of this brushable radial chart led to some feedback to make the filtering better. I introduced a #circularBrush.filter(array,accessor) that takes an array of data and and accessor for that data and returns to you the data that falls into the area of the brush. The functionality of this chart is no different than the other, but if you take a look at the code, it's much more efficient.