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) | |
tmp <- tempdir() | |
clone_call <- glue::glue(" | |
cd {tmp} | |
git clone [email protected]:marcosci/scooter_scraping.git") | |
# clone repo into temp dir | |
system(clone_call) |
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
Okay, so the goal is to have access to tidymodels from Databricks. My answer is a more general approach to package access in Databricks. This approach will lead to slightly slower spin up time. | |
The idea is to have persistent storage in the form of a ADLS blob storage container where packages are installed to. Then, when you spin up a cluster, install any required system deps and change your `options("repos")` to the ADLS container. | |
You can mount the container using one of these two approaches: | |
- [directly to the workspace](https://docs.microsoft.com/en-us/azure/databricks/data/mounts) | |
- [using blobfuse](https://docs.microsoft.com/en-us/azure/storage/blobs/storage-how-to-mount-container-linux) |
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
```{r} | |
fp <- "https://raw.githubusercontent.com/gdsbook/book/master/data/tokyo/tokyo_clean.csv" | |
user <- readr::read_csv(fp) |> | |
dplyr::filter(user_id == "95795770@N00") |> | |
sf::st_as_sf(coords = c("x", "y")) | |
hull <- sf::st_geometry(user) |> | |
geos::geos_make_collection() |> | |
geos::geos_concave_hull(ratio = 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
data(guerry, package = "sfdep") | |
library(dplyr) | |
library(spdep) | |
transmute(guerry, neighbors = spdep::poly2nb(geometry)) | |
class_modify <- function(x, class = "list") { | |
current <- class(x) | |
class(x) <- c(current, class) |
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
/* rs-theme-name: Light theme {rsthemes} */ | |
/* rs-theme-is-dark: FALSE */ | |
.ace_gutter { | |
background: #e8e8e8; | |
color: #6b6b6b; | |
} | |
.ace_print-margin { | |
width: 2px; | |
background: rgba(136, 114, 50, 0.188235); |
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
/* rs-theme-name: Light theme {rsthemes} */ | |
/* rs-theme-is-dark: FALSE */ | |
.ace_gutter { | |
background: #e8e8e8; | |
color: #6b6b6b; | |
} | |
.ace_print-margin { | |
width: 2px; | |
background: rgba(136, 114, 50, 0.188235); |
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
make_route_name <- function(x) { | |
strsplit(x, ", ") |> | |
unlist() |> | |
unique() |> | |
paste(collapse = ", ") | |
} | |
routes <- c("426, 442, 450, 455, T116", "113, 99, T109, T110") |
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
# create a new class called df | |
# it recreates a printing method for lists. | |
# recreates a subsetting function | |
# constructor | |
new_rectangle <- function(.data, ...) { | |
# checking function for assertions | |
structure(.data, class = "rectangle") | |
} |
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
# Function to run to check if you have any missing `\value{}` tags | |
check_missing_value <- function(pkg = ".") { | |
pkg_root <- rprojroot::find_package_root_file(path = pkg) | |
# find exported functions | |
ns <- readLines(file.path(pkg_root, "NAMESPACE")) | |
exports <- ns[which(grepl("export", ns))] | |
# https://stackoverflow.com/questions/8613237/extract-info-inside-all-parenthesis-in-r | |
exported_fxs <- stringr::str_extract(exports, "(?<=\\().+?(?=\\))") | |
# parse all man pages |
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: "Spatial Relationships" | |
format: | |
revealjs: | |
incremental: true | |
--- | |
```{r, include = FALSE} | |
# plots for later |