Skip to content

Instantly share code, notes, and snippets.

View jmcastagnetto's full-sized avatar
🇵🇪
Focusing

Jesus M. Castagnetto jmcastagnetto

🇵🇪
Focusing
View GitHub Profile
#### ---------------------------------------------
## Edit via: RStudio > Tools > Edit Code Snippets
# Released under a MIT license
snippet fragment
[${1:text}]{.${2:type}}
snippet aside
[${1:text}]{.aside}
@AlbertRapp
AlbertRapp / nycflights_calender.qmd
Created July 9, 2022 11:15
NYC flights calendar plot
library(tidyverse)
color_palette <- thematic::okabe_ito(8)
flights <- nycflights13::flights
counts <- flights %>%
mutate(
date = lubridate::make_date(year = year, month = month, day = day)
) %>%
count(date) %>%
mutate(
@Pakillo
Pakillo / relief_maps_rspatial.R
Last active July 22, 2022 15:59
Quick elevation maps with R
library(sf)
library(terra)
## Define area
coords <- data.frame(x = c(-5.5, -5.5, -5.3, -5.3),
y = c(36.7, 36.8, 36.7, 36.8))
coords.sf <- st_as_sf(coords, coords = c("x", "y"), crs = 4326)
## Download elevation data
@tylermorganwall
tylermorganwall / humanity_globe.R
Created August 17, 2021 14:37
3D Humanity Globe
library(rayshader)
library(rayrender)
popdata = raster::raster("gpw_v4_population_density_rev11_2020_15_min.tif")
population_mat = rayshader:::flipud(raster_to_matrix(popdata))
above1 = population_mat > 1
above5 = population_mat > 5
above10 = population_mat > 10
@tylermorganwall
tylermorganwall / hadley_attractor.R
Last active April 9, 2021 19:06
3D Hadley Attractor
library(deSolve)
library(rayrender)
parameters = c(a = 0.2, b = 4, c = 8, d = 1)
state = c(X = 1, Y = 0, Z = 1)
Lorenz = function(t, state, parameters) {
with(as.list(c(state, parameters)), {
dX = -Y^2 - Z^2 - a*X + a*c
dY = X * Y - b * X * Z - Y + d
dZ = b * X * Y + X * Z - Z
library(arrow)
library(tidyverse)
library(tictoc)
# create a parent directory
dir.create("nflfastr")
# create function for partition directories and download parquet files
get_data <- function(year){
dir.create(file.path("nflfastr", year))
library(tidyverse)
# Download Fira Sans Condensed from
# https://fonts.google.com/specimen/Fira+Sans+Condensed
high_mean <- 12
high_sd <- 4
flat_mean <- 35
flat_sd <- 12
@rxaviers
rxaviers / gist:7360908
Last active May 17, 2024 08:34
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue: