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(ggplot2) | |
| all_plots <- list() | |
| m <- as.matrix(penguins[,3:6]) | |
| for (i in 1:ncol(m)) { | |
| gg <- ggplot(penguins, aes(bill_len, m[,i])) + | |
| geom_point() + | |
| labs(title = sprintf("Column %i", i)) |
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
| # This should be in .Renviron | |
| Sys.setenv("ARCGIS_HOST" = "your-portal-host") | |
| Sys.setenv( | |
| "ARCGIS_API_KEY" = "your-api-key" | |
| ) | |
| library(arcgis) | |
| set_arc_token(auth_key(key)) |
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
| pub trait Coalesce { | |
| type Item; | |
| fn coalesce(self, other: Option<Self::Item>) -> Option<Self::Item>; | |
| } | |
| impl<T> Coalesce for Option<T> { | |
| type Item = T; | |
| fn coalesce(self, other: Option<T>) -> Option<T> { | |
| self.or(other) |
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")) | |
| }) |
NewerOlder