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
_____________________ | |
TIDY DATA WORKSHEET | |
Kai | |
_____________________ | |
2024-03-25 Mon |
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(rvest) | |
library(stringr) | |
read_html("https://rosalind.info/statistics/countries/") |> | |
html_elements(".span3") |> | |
html_text(trim = T) |> | |
stringr::str_extract("[:digit:]*$") |> | |
as.numeric() |> | |
sum() |
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
# 'Flip' numbers on a number interval | |
# my_nums: 1 2 5 10 | |
# 1 | |
# interval: 1 ---- 2 ---- 3 ---- 4 ---- 5 ---- 6 ---- 7 ---- 8 ---- 9 ---- 10 | |
# Flipped: | |
# newnums: 1 6 9 10 | |
# 10 |
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
snippet slfp | |
${1:name} <- ${1:name} |> |
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(ggplot2) | |
library(showtext) | |
showtext_auto() | |
if(Sys.info()[["sysname"]] == "Windows") { | |
font_add("GillSans", "GIL_____.TTF") | |
} else if(Sys.info()[["sysname"]] == "Darwin") { | |
font_add("GillSans", "GillSans.ttc") | |
} |