This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(igraph) | |
| library(ggraph) | |
| input <- readr::read_lines("inputs/actual/11.txt") | |
| parse_line <- function(line) { | |
| x <- stringr::str_split(line, ": ")[[1]] | |
| node <- x[[1]] | |
| edges <- stringr::str_split(x[[2]], " ")[[1]] |> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(lpSolve) | |
| solve_button_problem <- function(buttons, target, costs) { | |
| n_buttons <- nrow(buttons) | |
| n_positions <- ncol(buttons) | |
| constraints_matrix <- t(buttons) | |
| constraints_rhs <- target | |
| constraints_dir <- rep("=", n_positions) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(tidyverse) | |
| library(sf) | |
| input <- readr::read_lines("inputs/actual/09.txt") | |
| points <- str_split(input, ",") |> | |
| lapply(as.integer) | |
| make_rectangle <- function(p1, p2) { | |
| sf::st_polygon(list(rbind( | |
| c(p1[1], p1[2]), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #' Get Azure Token | |
| #' | |
| #' This function retrieves an Azure token for a specified resource. It first attempts to get a managed token. | |
| #' If that fails, it tries to retrieve a user token using the provided parameters. | |
| #' | |
| #' @param resource A string specifying the Azure resource for which the token is requested. | |
| #' Defaults to `"https://storage.azure.com"`. | |
| #' @param tenant A string specifying the Azure tenant. Defaults to `"common"`. | |
| #' @param app A string specifying the application ID (client ID). If `NULL`, the function attempts to retrieve | |
| #' the app ID from the AzureRMR token or prompts the user to log in to retrieve it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(stringr) | |
| library(readr) | |
| i <- read_file("inputs/day03.txt") | |
| f <- function(i) { | |
| str_extract_all(i, "(?<=mul\\()(\\d+),(\\d+)(?=\\))")[[1]] |> | |
| str_split(",") |> | |
| sapply(as.numeric) |> | |
| apply(2, prod) |> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(tidyverse) | |
| library(janitor) | |
| get_hes_summary_stats_csv <- function(url) { | |
| url |> | |
| readr::read_csv() |> | |
| clean_names() |> | |
| select(-"uid") |> | |
| filter( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(tidyverse) | |
| library(igraph) | |
| library(tidygraph) | |
| library(ggraph) | |
| input <- read_file("inputs/day25.txt") |> | |
| stringr::str_trim() |> | |
| str_split("\n") |> | |
| pluck(1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", | |
| "version": 2, | |
| "final_space": true, | |
| "blocks": [ | |
| { | |
| "type": "prompt", | |
| "alignment": "left", | |
| "segments": [ | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| code | description | |
|---|---|---|
| A | Nervous System | |
| B | Eyes and Periorbita | |
| C | Ear, Nose, Mouth, Throat, Neck and Dental | |
| D | Respiratory System | |
| E | Cardiac Surgery and Primary Cardiac Conditions | |
| F | Digestive System | |
| G | Hepatobiliary and Pancreatic System | |
| H | Musculoskeletal System | |
| J | Skin, Breast and Burns |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| title: "Fuzzy joining tables using string distance methods" | |
| format: html | |
| --- | |
| ```{r setup} | |
| suppressPackageStartupMessages({ | |
| library(tidyverse) | |
| library(sf) | |
| library(janitor) |
NewerOlder