Skip to content

Instantly share code, notes, and snippets.

View jthomasmock's full-sized avatar

Tom Mock jthomasmock

View GitHub Profile
ex_bold <- ggplot(mtcars, aes(disp, mpg)) +
geom_point() +
labs(
title = "<b>Fuel economy</b> vs. <i>engine displacement</i><br>
<span style = 'font-size:10pt'>Lorem ipsum *dolor sit amet,*
consectetur adipiscing elit, **sed do eiusmod tempor incididunt** ut
labore et dolore magna aliqua. <span style = 'color:red;'>Ut enim
ad minim veniam,</span> quis nostrud exercitation ullamco laboris nisi
ut aliquip ex ea commodo consequat.</span>",
x = "displacement (in<sup>3</sup>)",
library(rtweet)
library(ggplot2)
# create a plot, with alt-text labeling
ex_plot <- ggplot(mpg, aes(x = displ, y = hwy)) +
geom_point() +
labs(alt = glue::glue(
"A scattergraph of engine displacement in litres ({range(mpg$displ) |> paste0(collapse = ' to ')}) on the x-axis and highway fuel efficiency in mpg ({range(mpg$hwy) |> paste0(collapse = ' to ')}) on the y-axis. There is a negative, linear trend, where as engine displacement increases, fuel efficiency decreases."
)
)
#### ---------------------------------------------
## Edit via: RStudio > Tools > Edit Code Snippets
# Released under a MIT license
snippet fragment
[${1:text}]{.${2:type}}
snippet aside
[${1:text}]{.aside}
---
title: "Presentation"
format:
revealjs:
theme: [default, custom.scss]
---
## Slide 1
- List
---
title: "Intro to Grammar of Graphics"
subtitle: "seaborn vs plotnine"
author: "Credit to @ChelseaParlett"
jupyter: venv-prez-kernel
format:
revealjs:
height: 1400
width: 1920
execute:
# From terminal
quarto render boston-terrier.ipynb
---
format: revealjs
engine: knitr
---
## Cards, on a page
```{css, echo=FALSE}
.card {
/* Add shadows to create the "card" effect */
@jthomasmock
jthomasmock / count-rstudio.R
Last active August 4, 2022 13:25
Count in-person attendees per talk at RStudio conf.
library(tidyverse)
library(jsonlite)
library(rvest)
raw_json <- fromJSON("https://raw.githubusercontent.com/rstudio/rstudio-conf-2022-program/main/program.json", simplifyVector = FALSE)
raw_df <- raw_json |>
enframe() |>
unnest_wider(value) |>
hoist(talk,
``` r
x <- c(
"task_0_files", "task_1_files", "task_11_files",
"task_14_files", "task_5_files"
)
stringr::str_sort(x, numeric = TRUE) |>
tibble::enframe()
#> # A tibble: 5 × 2
#> name value
---
format:
html:
theme:
- litera
execute:
echo: false
---
# Apache Arrow R questions on Stack Overfklow