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(RSQLite) | |
db_disk <- dbConnect(SQLite(), "/path/to/database.sqlite3") | |
db_mem <- dbConnect(SQLite(), ":memory:") | |
sqliteCopyDatabase(db_disk, db_mem) |
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(shiny) | |
library(calcite) | |
library(htmltools) | |
library(arcgisutils) | |
# read in our sample dataset | |
earthquakes <- sf::st_read( | |
"https://github.com/R-ArcGIS/calcite/raw/refs/heads/main/dev/earthquakes.fgb" | |
) |
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(arrow) | |
library(geoarrow) | |
library(sf) | |
# following example here: https://geoarrow.org/geoarrow-r/index.html | |
nc <- read_sf(system.file("gpkg/nc.gpkg", package = "sf")) | |
tf <- tempfile(fileext = ".parquet") | |
# this creates a GeoParquet file | |
nc |> |
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(dplyr) | |
api <- as_tibble(tools:::funAPI()) | |
# list all header files from include dir | |
header_files <- list.files( | |
R.home("include"), | |
full.names = TRUE, | |
recursive = TRUE, |
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
use rand::{rng, seq::SliceRandom}; | |
use std::{ | |
io::Result, | |
net::{IpAddr, SocketAddr, TcpListener, ToSocketAddrs}, | |
vec::IntoIter, | |
}; | |
pub struct RandomUserPort(std::ops::RangeInclusive<u16>); | |
impl RandomUserPort { |
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
list_all_files <- function(include = "*") { | |
# list all files in the current directory recursing | |
all_files <- fs::dir_ls(recurse = TRUE, all = TRUE, type = "any") | |
# Identify directory patterns explicitly mentioned | |
matched_dirs <- include[fs::dir_exists(include)] | |
# Get *all* files inside matched directories | |
extra_files <- unlist( | |
lapply( |
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
app <- ambiorix::Ambiorix$new() | |
app$post("/process", function(req, res) { | |
body <- yyjsonr::read_json_raw(req$rook.input$read()) | |
msg <- sprintf( | |
"Hello, %s! Your age is %i, and your email is %s.", | |
body[["name"]], body[["age"]], body[["email"]] | |
) | |
res$json(list(message = msg, status = "success")) | |
}) |
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
log <- tempfile(fileext = ".log") | |
con <- file(log, open = "a") | |
addTaskCallback( | |
function(expr, value, ok, visible) { | |
if (rlang::is_condition(value)) { | |
write("Found a condition!!!!", con, append = TRUE) | |
} | |
if (visible) { | |
msg <- sprintf("[%sZ] > %s", format(Sys.time()), format(expr)) |
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(sfdep) | |
library(dplyr) | |
library(spdep) | |
guerry_nb |> | |
reframe(across(where(is.numeric), \(.x) broom::tidy(global_moran_perm(.x, nb, wt)))) |> | |
tidyr::pivot_longer(everything()) |> | |
tidyr::unnest(value) | |
moran_all <- function(.data, vars, nb_col = "nb", wt_col = "wt") { |
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
use serde::{Deserialize, Serialize}; | |
use std::collections::HashMap; | |
use std::fs::File; | |
use std::io::BufReader; | |
use std::path::Path; | |
#[derive(Debug, Clone, Serialize, Deserialize)] | |
#[serde(rename_all = "PascalCase")] | |
pub struct RenvLock { | |
pub r: RenvRVersion, |
NewerOlder