Skip to content

Instantly share code, notes, and snippets.

View lbarqueira's full-sized avatar

Luis Barqueira lbarqueira

View GitHub Profile
@mschnetzer
mschnetzer / gfcf.R
Last active March 17, 2024 13:03
Bruttoanlageinvestitionen in % des BIP (https://x.com/matschnetzer/status/1768627118580089130?s=20)
library(tidyverse)
library(countrycode)
library(rdbnomics)
library(ggbump)
library(MetBrewer)
library(scales)
allcty <- codelist |> filter(!is.na(eu28)) |> pull(iso3c) |> tolower()
gfcf_private <- rdb(provider_code = "AMECO", dataset_code = "UIGP",
@wiesehahn
wiesehahn / render_pointcloud.R
Created September 10, 2023 12:14
Example how to render pointclouds in R with rayrender
##___________________________________________________
##
## Script name: render_pointcloud.R
##
## Purpose of script:
## render forest plot pointcloud with raytracing
##
## Author: Jens Wiesehahn
## Copyright (c) Jens Wiesehahn, 2023
## Email: wiesehahn.jens@gmail.com

Get elevation data from Copernicus 30m or GEBCO 2023. Run get_elev(rast) with any raster to get elevation data from online.

The function chooses which source based on the distance across the centre cell of the query raster, if that is less than 'threshold' it goes for the 30m SRTM source "cop30".

Requires in-dev terra, see install instructs in code below

  library(terra)
#> terra 1.7.41
library(tidyverse)
library(rvest)
library(cropcircles)
library(magick)
library(gt)
library(gtExtras)
data <- read_html("https://sport.orf.at/stories/3111293/") |>
html_elements("section") |>
html_table() |>
library(tidyverse)
library(eurostat)
library(countrycode)
library(gt)
library(gtExtras)
data <- get_eurostat("prc_hicp_manr", filters = list(coicop = "CP00"))
ea.avg <- data |> filter(geo == "EA") |> slice_max(time, n=1) |> pull(values)
@tylermorganwall
tylermorganwall / glowing_contours.R
Created February 24, 2023 02:29
Glowing Contours in R
library(rayshader)
volcano |>
height_shade() |>
plot_3d(volcano,zscale=3)
render_contours(volcano, clear_previous = T, offset=1,color="purple",
zscale=3, nlevels = 20)
for(i in 1:360) {
@hvisser
hvisser / MaterialConversions.kt
Last active May 15, 2024 09:16
Using both Material 3 and material components in Compose within the same theme
// conversions based on https://material.io/blog/migrating-material-3, deprecated colors set to Colors.Red
@Composable
fun fromMaterial3Theme(isLight: Boolean): Colors {
val scheme = MaterialTheme.colorScheme
return Colors(
primary = scheme.primary,
primaryVariant = Color.Red,
secondary = scheme.secondary,
secondaryVariant = Color.Red,
background = scheme.background,
@tylermorganwall
tylermorganwall / submarine_cable_map.R
Last active April 19, 2024 07:36
Submarine Cable Map Dataviz
library(geojsonsf)
library(sf)
library(rayrender)
#Data source: https://github.com/telegeography/www.submarinecablemap.com
cables = geojson_sf("cable-geo.json")
cablescene = list()
counter = 1
for(i in 1:length(cables$geometry)) {
@norwegianblueparrot
norwegianblueparrot / bourtange.R
Last active November 25, 2023 03:40
A script to produce a 3D render of Fort Bourtange from LiDAR data
## ----setup,include=FALSE,message=FALSE,warning=FALSE-----------------------------------------------------------------------------------------------------------------------------------------------------
library("here") # 1.0.1
library("sf") # 1.0-14
library("rgl") # 1.2.1
library("geoviz") # 0.2.2
library("raster") # 3.6-26
library("rayshader") # 0.35.7
library("osmdata") # 0.2.5
library("tidyverse") # 2.0.0
@akueisara
akueisara / design_patterns.md
Last active March 19, 2024 05:57
Design Patterns by University of Alberta

Design Patterns

Week 1

1. Gang of Four's Pattern Catalogue

Design Patterns: Elements of Reusable Object-Oriented Software – Gamma, Helm, Johnson, and Vlissides

2. Categories of Patterns