Skip to content

Instantly share code, notes, and snippets.

Avatar

Bruno Rodrigues b-rodrigues

View GitHub Profile
View gist:3f4eac56dec315d9f0ef1df9063d7e84
get_counts <- function(dataset, var){
dataset %>%
group_by(am) %>%
mutate("change_{{var}}" := n_distinct({{var}})) %>%
mutate(total = across(starts_with("change"), identity)) %>%
mutate(total = unlist(total)) %>%
filter(total == 11) %>%
select(-total)
View gist:1446b319c310c22431913ebc29804c9e
dput(sort(unique(as.character(tcltk::tkfont.families()))))
c("!Y2KBUG", "1980 Portable", "256 Bytes", "6809chargen", "Abberancy",
"Adobe Courier", "Adobe Helvetica", "Adobe New Century Schoolbook",
"Adobe Symbol", "Adobe Times", "Adobe Utopia", "Adriator", "Airmole",
"Airmole Antique", "Airmole Shaded", "Airmole Stripe", "Almonte",
"Almonte Snow", "Almonte Woodgrain", "Anglepoise Lampshade",
"Anklepants", "Arabic Newspaper", "Arnprior", "Astron Boy", "Astron Boy Video",
"Astron Boy Wonder", "Axaxax", "B&H Lucida", "B&H LucidaBright",
"B&H LucidaTypewriter", "Baby Jeepers", "BaileysCar", "Balker",
View gist:696c3174d866125055f716b620ad47ec
dput(sort(unique(as.character(tcltk::tkfont.families()))))
c("@Malgun Gothic", "@Malgun Gothic Semilight", "@Microsoft JhengHei",
"@Microsoft JhengHei Light", "@Microsoft JhengHei UI", "@Microsoft JhengHei UI Light",
"@Microsoft YaHei", "@Microsoft YaHei Light", "@Microsoft YaHei UI",
"@Microsoft YaHei UI Light", "@MingLiU-ExtB", "@MingLiU_HKSCS-ExtB",
"@MS Gothic", "@MS PGothic", "@MS UI Gothic", "@NSimSun", "@PMingLiU-ExtB",
"@SimSun", "@SimSun-ExtB", "@Yu Gothic", "@Yu Gothic Light",
"@Yu Gothic Medium", "@Yu Gothic UI", "@Yu Gothic UI Light",
"@Yu Gothic UI Semibold", "@Yu Gothic UI Semilight", "8514oem",
View gist:0c08aea39ca9375b3d8da570fd696108
c("@Malgun Gothic", "@Malgun Gothic Semilight", "@Microsoft JhengHei",
"@Microsoft JhengHei Light", "@Microsoft JhengHei UI", "@Microsoft JhengHei UI Light",
"@Microsoft YaHei", "@Microsoft YaHei Light", "@Microsoft YaHei UI",
"@Microsoft YaHei UI Light", "@MingLiU-ExtB", "@MingLiU_HKSCS-ExtB",
"@MS Gothic", "@MS PGothic", "@MS UI Gothic", "@NSimSun", "@PMingLiU-ExtB",
"@SimSun", "@SimSun-ExtB", "@Yu Gothic", "@Yu Gothic Light",
"@Yu Gothic Medium", "@Yu Gothic UI", "@Yu Gothic UI Light",
"@Yu Gothic UI Semibold", "@Yu Gothic UI Semilight", "8514oem",
"Agency FB", "Algerian", "Arabic Transparent", "Arial", "Arial Baltic",
View gist:948156d09607e5e8e66b80e5b318a854
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%)")
View gist:ed62c86060c5f1901c8299a98fe44191
Put this code below in a file called example_report.Rmd
---
title: "Report for `r params$country`"
date: "`r format(Sys.time(), '%d %B, %Y')`"
output:
tufte::tufte_handout:
latex_engine: xelatex
params:
country: "country"
View gist:9b29fea2f238c81146a36736d9e97c90
---
title: "The power of DRY"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
#rmarkdown::render("iwalk_script.Rmd")
library(dplyr)
library(forcats)
View gist:9ed23236acce960ccec6f465403e14db
library(dplyr)
library(ggplot2)
library(lubridate)
library(COVID19)
covid <- covid19()
cases_deaths <- covid %>%
filter(iso_alpha_3 %in% c("AUT", "BEL", "BGR", "HRV",
View knitr_expand_example.Rmd
---
title: "Results of example survey"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
#rmarkdown::render("test.Rmd")
```
View survey_example.csv
Random question? Copy of Random question? Copy of Copy of Random question? Copy of Copy of Copy of Random question?
no yes yes yes
yes yes no yes
yes no no no
yes yes yes yes
no no yes yes
yes no no
no yes no no
yes yes
no yes no no