# Cocktails example by Hadley in 2021: Video https://youtu.be/kHFmtKCI_F4?si=HC4S3B-RI_l96sU4&t=1810 | Code: https://gist.github.com/hadley/a892ff8f00973e3bc864851deae8315f
# Added: New version using the replace_values function.
# Installing the new branch with the new feature
pak::pak("tidyverse/dplyr@feature/case-family")
#> ℹ Loading metadata database
#> ✔ Loading metadata database ... done
#>
#>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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(rextendr) | |
| library(mirai) | |
| rextendr::rust_source( | |
| file = "rust/xymatch_loop.rs", | |
| module = "xymatch_loop", | |
| profile = "release" | |
| ) | |
| rextendr::rust_source( | |
| file = "rust/xymatch_binary.rs", | |
| module = "xymatch_binary", |
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(S7) | |
| ScalarDouble <- new_class("ScalarDouble", | |
| properties = list(value = class_double), | |
| constructor = function(value) { | |
| stopifnot(is.double(value), length(value) == 1) | |
| new_object(ScalarDouble, value = value) | |
| } | |
| ) |
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
| stopifnot(requireNamespace("rlang")) | |
| rlang::check_installed("pak") | |
| pkgs <- rlang::chr( | |
| "tidymodels", | |
| "marginaleffects", | |
| "parameters", | |
| "modelbased", | |
| "dplyr", | |
| "stringr", | |
| "tibble", |
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
| stopifnot(requireNamespace("rlang")) | |
| rlang::check_installed("pak") | |
| pkgs <- rlang::chr( | |
| "rlang" = "rlang", | |
| "plumber2" = "posit-dev/plumber2", | |
| "S7", | |
| "jsonlite", | |
| "httr2", | |
| "mirai", |
rlang::check_required(c(
"patchwork",
"readxl",
"tidyverse",
"pak",
"showtext",
"systemfonts",
"sysfonts"
))pak::pak(c("ollamar", "ellmer", "tidyverse"))
library(ellmer)
library(tidyverse)
all_models <- c(
"qwen2.5:0.5b",
"qwen2.5-coder:3b",
"deepseek-coder:1.3b",
"internlm2:1m",
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(targets) | |
| library(tibble) | |
| library(readr) | |
| library(glmnet) | |
| # Step 1: load raw data | |
| load_raw_data <- function() { | |
| Sys.sleep(10) # simulate slow load | |
| tibble( |
NewerOlder