This file contains hidden or 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(ggplot2) | |
| library(patchwork) | |
| library(ggiraph) | |
| dat <- gapminder::gapminder |> | |
| janitor::clean_names() |> | |
| mutate( | |
| # ID that is shared for boxplots (this one uses factors, i.e. numbers, as ID instead of continents) |
This file contains hidden or 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(shiny) | |
| library(bslib) | |
| library(bsicons) | |
| ui <- fluidPage( | |
| theme = bslib::bs_theme(), | |
| h1('One Box'), | |
| fluidRow( | |
| column( |
This file contains hidden or 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(shiny) | |
| library(bs4Dash) | |
| ui <- dashboardPage( | |
| header = dashboardHeader(), | |
| sidebar = dashboardSidebar(), | |
| body = dashboardBody( | |
| h1('One Box'), | |
| fluidRow( | |
| actionButton('btn', 'Think of this button as some cool interactive element that reveals important information', width = '400px'), |
This file contains hidden or 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
| ```{r} | |
| setwd(here::here('connected_scatterplots')) | |
| library(tidyverse) | |
| library(lubridate) | |
| library(patchwork) | |
| library(showtext) |
This file contains hidden or 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(shiny) | |
| library(bs4Dash) | |
| ui <- dashboardPage( | |
| header = dashboardHeader(), | |
| sidebar = dashboardSidebar(skin = 'light'), | |
| body = dashboardBody( | |
| fluidRow( | |
| actionButton('btn', 'Click me', width = '200px'), | |
| bs4ValueBoxOutput('click_box', width = 4) |
This file contains hidden or 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(shiny) | |
| library(bslib) | |
| library(bsicons) | |
| ui <- fluidPage( | |
| theme = bs_theme(), | |
| title = 'Testapp', | |
| h3('Test App'), | |
| sidebarLayout( |
This file contains hidden or 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) | |
| manufacturers <- mpg |> | |
| count(manufacturer, sort = TRUE) |> | |
| mutate( | |
| manufacturer = str_to_title(manufacturer), | |
| manufacturer = fct_reorder(manufacturer, n) | |
| ) |
This file contains hidden or 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) | |
| # Helper function to do one single step | |
| move_one_step <- function(head_tail_list, dir) { | |
| n <- length(head_tail_list) | |
| for (i in seq_along(head_tail_list)[-n]) { | |
| # Get coordinates of current head-tail-pair | |
| head_x <- head_tail_list[[i]]$x[length(head_tail_list[[i]]$x)] | |
| head_y <- head_tail_list[[i]]$y[length(head_tail_list[[i]]$y)] | |
| tail_x <- head_tail_list[[i + 1]]$x[length(head_tail_list[[i + 1]]$x)] |
This file contains hidden or 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
| # Most of the code has been adapted from | |
| # https://nrennie.rbind.io/blog/2022-12-03-how-to-make-your-own-rstats-wrapped/ | |
| setwd(here::here('blog_fcts/')) | |
| base_path <- 'Your_own_file_path_to_Blog_directory' | |
| files <- list.files( | |
| path = base_path, | |
| recursive = TRUE | |
| ) |
This file contains hidden or 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) | |
| calories_input <- read_lines('data/2022_day01.txt') | |
| total_calories_per_elf <- tibble( | |
| calories = parse_number(calories_input) | |
| ) |> | |
| mutate(elf = cumsum(if_else(is.na(calories), 1, 0))) |> | |
| group_by(elf) |> | |
| summarise(calories = sum(calories, na.rm = T)) | |