This file contains 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 facet page slider module UI | |
facetPageUI <- function(id) { | |
tagList( | |
sliderInput( | |
NS(id, "facet_page"), | |
"Facet page:", | |
value = 1, | |
min = 1, | |
max = 2, | |
step = 1, |
This file contains 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
# first star | |
df <- read.table(text = puzzle_input, header = FALSE, sep = "\n") | |
df$digits <- as.numeric(paste0(sub(".*?(\\d).*", "\\1", df$V1), sub(".*(\\d+).*$", "\\1", df$V1))) | |
sum_cal_values <- sum(df$digits) | |
# second star | |
df$V2 <- sapply(df$V1, function(x){ | |
gsub("one", "o1e", | |
gsub("two", "t2o", | |
gsub("three", "thr3e", |
This file contains 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
Almost all - if not all - of my new R projects are targets projects. | |
I'm usually bouncing between computers and occasionally have a collaborator, so targets makes it super super simple to spin up | |
my analyses at another computer. | |
Nowadays, I don't just use a targets project, but I like having multiple targets projects within one targets project. This | |
keeps the pipelines from getting to unweildly, at which point I usually get pretty overwhelmed. | |
(From here on, assume that when I say 'project' I mean a targets project, not an RStudio project - all of this happens in a | |
single RStudio project) |
This file contains 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(tidyverse) | |
big_tech_companies <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2023/2023-02-07/big_tech_companies.csv') | |
big_tech_companies | |
# # A tibble: 14 × 2 | |
# stock_symbol company | |
# <chr> <chr> | |
# 1 AAPL Apple Inc. | |
# 2 ADBE Adobe Inc. | |
# 3 AMZN Amazon.com, Inc. | |
# 4 CRM Salesforce, Inc. |
This file contains 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
// save to windows-user directory | |
linters: with_defaults(object_name_linter = NULL, | |
object_length_linter(50), | |
commented_code_linter = NULL, | |
object_usage_linter = NULL, | |
line_length_linter(120), | |
cyclocomp_linter = cyclocomp_linter(50)) |
This file contains 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) | |
library(arrow) | |
library(duckdb) | |
# install.packages(c("dplyr", "arrpw", "duckdb", "nycflights13")) | |
## Export the nycflights13 dataset to arrow format ---- | |
nycflights13::flights |> |
This file contains 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
--- | |
output: html_document | |
editor_options: | |
chunk_output_type: console | |
--- | |
```{r} | |
setwd(here::here('stacked_bar_alternative/')) | |
camcorder::gg_record( | |
dir = 'img', |
This file contains 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(palmerpenguins) | |
library(ggtext) | |
library(colorspace) | |
library(ragg) | |
url <- "https://raw.githubusercontent.com/allisonhorst/palmerpenguins/master/man/figures/lter_penguins.png" | |
img <- magick::image_read((url)) | |
pic <- grid::rasterGrob(img, interpolate = TRUE) | |
pal <- c("#FF8C00", "#A034F0", "#159090") |
This file contains 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
options(reactable.theme = reactable::reactableTheme( | |
color = "hsl(233, 9%, 87%)", | |
backgroundColor = "#002b36", | |
borderColor = "#eee8d5", | |
stripedColor = "#586e75", | |
highlightColor = "#6c71c4", | |
inputStyle = list(backgroundColor = "hsl(233, 9%, 25%)"), | |
selectStyle = list(backgroundColor = "hsl(233, 9%, 25%)"), | |
pageButtonHoverStyle = list(backgroundColor = "hsl(233, 9%, 25%)"), | |
pageButtonActiveStyle = list(backgroundColor = "hsl(233, 9%, 28%)") |
This file contains 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(sf) | |
library(ggplot2) | |
# Data from https://www.geoboundaries.org/index.html#getdata | |
de2 <- read_sf("data/geoBoundaries-DEU-ADM2-all/geoBoundaries-DEU-ADM2_simplified.shp") | |
# Extract Munich and Berlin to separate objects | |
munich <- dplyr::filter(de2, DistrictCo == "09162") | |
berlin <- dplyr::filter(de2, DistrictCo == "11000") |
NewerOlder