Skip to content

Instantly share code, notes, and snippets.

View JosiahParry's full-sized avatar
💻
on the 'puter

Josiah Parry JosiahParry

💻
on the 'puter
View GitHub Profile
library(tidyverse)
# https://github.com/rfordatascience/tidytuesday/tree/master/data/2020/2020-03-24
# Get the Data
tbi_age <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-03-24/tbi_age.csv')
tbi_year <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-03-24/tbi_year.csv')
tbi_military <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-03-24/tbi_military.csv')
library(rvest)
library(dplyr)
library(stringr)
library(purrr)
session <- html_session("http://insideairbnb.com/get-the-data.html")
all_downloads <- session %>%
html_nodes("table.table-hover.table-striped.boston a")
/* rs-theme-name: Keeping Warm */
/* rs-theme-is-dark: TRUE */
/* THIS THEME WAS AUTOGENERATED BY Theme.tmpl.css (UUID: 66e611c4-a4d0-4887-ae0e-c646bb2cf35f) */
.ace_gutter {
background: #3A3E45;
color: #90908A;
}
.ace_print-margin {
library(tidyverse)
unique_sums <- expand.grid(dice_1 = 1:6, dice_2 = 1:6) %>%
mutate(die_sum = dice_1 + dice_2) %>%
pull(die_sum) %>%
unique()
all_divisble <- function(x, divisor) {
divisible_int <- identical((x / divisor), round(x / divisor))
@JosiahParry
JosiahParry / ex.R
Created July 31, 2021 15:56
Find polygon distances for combined nb list
library(sf)
library(sfweight)
library(tidyverse)
acs %>%
mutate(nb = st_neighbors(geometry),
# centroids are used for distance calculation
centroid = st_centroid(geometry),
# finding nearest polygon based on centroid
nb2 = st_knn(centroid),
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!-- Generated by: TmTheme-Editor -->
<!-- ============================================ -->
<!-- app: http://tmtheme-editor.herokuapp.com -->
<!-- code: https://github.com/aziz/tmTheme-Editor -->
<plist version="1.0">
<dict>
<key>name</key>
<string>Alll the things</string>
options("repos" = c("CRAN" = "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"))
install.packages("pak")
# List of R packages to install
to_install <- readLines("all-pkgs.txt")
# copy of purrrs safely function for system requirements.
# this way we can capture errors associated with packages that
# wont be in paks database
capture_error <- function (code, otherwise = NULL, quiet = TRUE) {
@JosiahParry
JosiahParry / emo-candy-land.rstheme
Created April 6, 2022 13:33
xxEmoCandyLandxx RStudio Theme
/* rs-theme-name: xxEmoCandyLandxx*/
/* rs-theme-is-dark: TRUE */
.ace_gutter {
background: #372b2b3d;
color: #a36666;
}
.ace_print-margin {
width: 2px;
background: rgba(218, 146, 37, 0.470588);
dput(sort(unique(as.character(tcltk::tkfont.families()))))
#> Warning in fun(libname, pkgname): couldn't connect to display ":0"
#> Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj"): [tcl] invalid command name "font".
sessionInfo()
#> R version 4.1.2 (2021-11-01)
#> Platform: aarch64-apple-darwin20 (64-bit)
#> Running under: macOS Monterey 12.0
#>
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/lib/libRblas.0.dylib
@JosiahParry
JosiahParry / alphadev.R
Created June 18, 2022 01:38
development of alpha hull algorithm
nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"))
geo <- sf::st_centroid(nc) |>
sf::st_geometry()
tris <- geo |>
geos::geos_make_collection() |>
geos::geos_delaunay_triangles()
# this is what i would've preferred (and now do)