Skip to content

Instantly share code, notes, and snippets.

animal date
cow 05-05-2021
chicken 06-05-2021
horse 07-05-2021
dog 08-05-2021
@batpigandme
batpigandme / crssuggest_example.R
Last active March 5, 2020 12:38
Playing w/ Kyle E. Walker's crssuggest package.
# {crssuggest} by Kyle E Walker
# Get appropriate CRS suggestions for your spatial data in R
# src: https://github.com/walkerke/crsuggest
# remotes::install_github("walkerke/crsuggest")
## Use case 1: Analyzing unprojected data
library(tigris)
library(sf)
options(tigris_class = "sf")
@batpigandme
batpigandme / rowwise_pmin_pmap_dbl.R
Last active February 27, 2020 02:48
Same operation done using: rowwise(), pmin(), pmap_dbl()
library(tidyverse)
set.seed(406)
df <- tibble(x = runif(3), y = runif(3), z = runif(3))
df %>% rowwise() %>% mutate(m = min(c(x, y, z)))
df %>% mutate(m = pmin(x, y, z))
df %>% mutate(m = pmap_dbl(list(x, y, z), min))
@batpigandme
batpigandme / belchers_listcol.R
Last active March 5, 2023 17:39
Example of using `tidyr::hoist()`.
library(tidyverse)
family <- list(
list(
"name" = "Bob",
"age" = 46,
"mother" = NA,
"father" = "Big Bob",
"siblings" = list(NA),
"children" = list("Tina", "Gene", "Louise"),
Verifying my Blockstack ID is secured with the address 1BTT3yHBiFJV5Qa4Eu8Sn1HFnaDf7vi5jP https://explorer.blockstack.org/address/1BTT3yHBiFJV5Qa4Eu8Sn1HFnaDf7vi5jP
@batpigandme
batpigandme / R.snippets
Created April 18, 2019 13:33
snippet for overwriting data object
snippet aa
${1:dataset} <- ${1:dataset} %>% ${0}
<?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>LisaFrankentheme</string>
## Decoding lyrics — @pprevos
## https://github.com/pprevos/r.prevos.net/blob/master/Miscellaneous/lyrics.R
library(tidyverse)
library(tidytext)
library(reshape2)
library(rvest)
get_lyrics <- function(artist, song) {
artist <- gsub("[^A-Za-z0-9]+", "", tolower(artist))
/* rs-theme-name: Fake Night Owl */
/* rs-theme-is-dark: TRUE */
/* A port of Sarah Drasner's Night Owl VS Code theme (UUID: EB0EC8F4-467B-46D0-8AE9-88B44F4D73B4) */
.ace_gutter {
background: #011627;
color: rgb(108,122,137);
}
.ace_print-margin {
width: 1px;
background: #31364a;
---
title: "NBA All Stars: further adventures with `gt`"
author: "Mara Averick"
date: '`r Sys.Date()`'
output:
html_document:
keep_md: TRUE
---
```{r setup, include=FALSE}