Skip to content

Instantly share code, notes, and snippets.

View ivelasq's full-sized avatar

Isabella Velásquez ivelasq

View GitHub Profile
@ivelasq
ivelasq / resize.R
Created July 30, 2024 17:14
Resizing images using R
library(magick)
input_folder <- "test/"
output_folder <- "resized/"
if (!dir.exists(output_folder)) {
dir.create(output_folder)
}
image_files <- list.files(input_folder, full.names = TRUE, pattern = "\\.(jpg|jpeg|png)$")
library(shiny)
library(plotly)
library(gridlayout)
library(bslib)
ui <- grid_page(
layout = c("header header ",
"sidebar plot "),
row_sizes = c("100px",
"1fr"),
library(charlatan)
set.seed(1234)
(z <- AddressProvider$new('nl_NL'))
address_list <- purrr::map(1:5, function(x) {
dplyr::bind_cols(
building = z$building_number(),
street = z$street_address(),
@ivelasq
ivelasq / file-sizes.R
Created February 14, 2023 11:50
Find file sizes in directory
all_files <- fs::dir_ls(".", recurse = TRUE)
files_info <-
dplyr::bind_cols(all_files, fs::file_size(all_files))
@ivelasq
ivelasq / wp.html
Last active February 21, 2023 19:25
WordPress HTML
<!-- Code block -->
<pre class="sourceCode r code-with-copy" style="background-color: rgba(221,225,228,.2);"><span id="cb1-1" style="font-size: medium;">
</span></code></pre>
<!-- Quote block -->
<blockquote style="margin: 20px 0 30px; padding-left: 20px; border-left: 2px solid #7494B1;"><q class="body-md-regular">There are only two hard things in computer science: cache invalidation and naming things.</q></blockquote>
<!-- Indent bullet list -->
<ul style="padding-left: 30px;"></ul>
talks <-
tibble::tribble(
~ talks,
"{shinyslack}",
"{shinytest2}",
"A Journey to Data Science",
"A new way to build your Shiny app's UI",
"A Robust Framework for Automated Shiny App Testing",
"A touch of R in Robotics",
"Accelerating geospatial computing using Apache Arrow",
@ivelasq
ivelasq / queens.R
Created April 28, 2022 15:32
Silly plot of Henry VIII's wives
library(dplyr)
library(ggplot2)
library(emoGG)
library(MetBrewer)
dat <-
tibble::tribble(
~queen, ~marriage_start, ~marriage_end, ~reason, ~marriage_age,
"Catherine of Aragon", 1509, 1533L, "divorced", 23L,
"Anne Boleyn", 1533L, 1536L, "beheaded", 32L,
@ivelasq
ivelasq / quantile-fun.R
Created March 7, 2022 02:26
Demonstration of quantiles in R
set.seed(123)
dat <- rnorm(1001)
a <- quantile(dat, type = 1)
b <- quantile(dat, type = 2)
quantile(dat, type = 3)
quantile(dat, type = 4)
quantile(dat, type = 5)
quantile(dat, type = 6)
@ivelasq
ivelasq / app.R
Created January 4, 2022 15:26
Example Palmer Penguins Shiny Dashboard
library(shiny)
library(shinydashboard)
library(palmerpenguins)
library(tidyverse)
ui <- dashboardPage(
skin = "yellow",
dashboardHeader(title = "Example Palmer Penguins Dashboard",
titleWidth = 360),
dashboardSidebar(
@ivelasq
ivelasq / rotation.R
Last active January 7, 2023 03:39
Rotated ggplot2 graph
# Credits to this Stack Overflow post
# https://stackoverflow.com/questions/13445753/force-ggplot2-scatter-plot-to-be-square-shaped
library(ggplot2)
library(grid)
rotation <- 45
p <-
ggplot() +