Skip to content

Instantly share code, notes, and snippets.

View lcolladotor's full-sized avatar

Leonardo Collado-Torres lcolladotor

View GitHub Profile
@lcolladotor
lcolladotor / index.Rmd
Created August 29, 2025 13:58
postcards example with a favicon
---
title: "Tobi Burns"
image: "tobi.jpg"
links:
- label: LinkedIn
url: "https://linkedin.com/"
- label: Twitter
url: "https://twitter.com/"
- label: GitHub
url: "https://github.com/"
@lcolladotor
lcolladotor / bad_formatted_code.R
Created March 14, 2025 14:48
Examples of R code that is not correctly formatted
# Bad examples from https://style.tidyverse.org/syntax.html
x[,1]
x[ ,1]
x[ , 1]
# Bad
mean (x, na.rm = TRUE)
mean( x, na.rm = TRUE )
# Bad
@lcolladotor
lcolladotor / animated_tree.R
Last active December 25, 2024 00:04
Making an animated Christmas tree
## Original code: https://drmowinckels.io/blog/christmas-tree-in-ggplot/
## Original tweet: https://twitter.com/drmowinckels/status/1073261218276798465?s=12
## Other links:
# https://rladies-baltimore.github.io/post/making-holiday-cards-in-r-2018/
# https://twitter.com/fellgernon/status/1062769524917833728
# https://blogs.sas.com/content/iml/2012/12/14/a-fractal-christmas-tree.html
# https://twitter.com/thomasp85/status/811537760783912960
## Link to tweet about this code:
@lcolladotor
lcolladotor / Finding sugar in more general ways.R
Last active September 18, 2024 15:47
Searching for Sugar vs Sweetener vs Salt
library("tidyverse")
library("here")
chocolate <- readRDS(here("data", "chocolate.RDS"))
## Base R solution
has_sugar <- sapply(
strsplit(
gsub(" ", "", gsub(".*-", "", chocolate$ingredients)),
","),
function(x) { any(x == "S") }
@lcolladotor
lcolladotor / reading chocolate.R
Created September 11, 2024 14:40
Output from reprex::reprex(wd = here::here())
library("tidyverse")
library("here")
chocolate <- readRDS(here("data", "chocolate.RDS"))
glimpse(chocolate)
options(width = 120)
sessioninfo::session_info()
## After copying the above, I ran:
# reprex::reprex(wd = here::here())
@lcolladotor
lcolladotor / R 4.3.2 bioc 3.18 test.R
Last active May 21, 2024 17:50
bioc support 9158418
## R 4.3.2 bioc 3.18 test
```R
> library("recount3")
> args(recount3_cache)
function (cache_dir = getOption("recount3_cache", NULL))
NULL
> rse_data <- recount3::create_rse_manual(
+ project = "SRP045225",
+ project_home = "data_sources/sra",
@lcolladotor
lcolladotor / notes.R
Last active September 25, 2023 19:55
Notes from my session with Natalie
library("dplyr")
library("sessioninfo")
tuesdata <- tidytuesdayR::tt_load("2020-01-07")
rainfall <- tuesdata$rainfall
rainfall_filtered <- rainfall %>%
filter(city_name == "Cuernavaca")
rainfall_filtered
@lcolladotor
lcolladotor / migrate_hugo_shortcode_tweet.R
Last active May 1, 2022 06:31
Code for migrating hugo tweet shortcode. Related to https://github.com/rstudio/blogdown/issues/701
x <- c("/Users/leocollado/Dropbox/Code/lcolladotorsource/content/post/2018-04-19-latin-american-r-bioconductor-developers-workshop-2018.html:44:1",
"/Users/leocollado/Dropbox/Code/lcolladotorsource/content/post/2018-06-11-mindfulness.html:27:1",
"/Users/leocollado/Dropbox/Code/lcolladotorsource/content/post/2018-07-30-harrassment-diversity-in-science-and-inspiraton-from-my-grandmother.html:24:1",
"/Users/leocollado/Dropbox/Code/lcolladotorsource/content/post/2018-09-13-r-gene-regulatory-interaction-formulator-for-inquiring-networks.html:132:1",
"/Users/leocollado/Dropbox/Code/lcolladotorsource/content/post/2018-09-17-what-about-a-lawyer-like-app-as-the-mininum-help-for-defandants-in-immigration-cases.html:110:1",
"/Users/leocollado/Dropbox/Code/lcolladotorsource/content/post/2018-10-16-ashg18-tweet-summary.html:21:1",
"/Users/leocollado/Dropbox/Code/lcolladotorsource/content/post/2018-09-29-why-i-applied-to-join-sni-the-mexican-national-researchers-registry.html:21:1",
"/Users/leocollado/Dropbox/Code/lcollado
@lcolladotor
lcolladotor / gantt.R
Last active March 24, 2022 14:09
Live coding gantt
## Load required libraries
library("googlesheets4")
library("dplyr")
library("ggplot2")
library("plotly")
## For reproducibility
library("sessioninfo")
## Authenticate with Google
googlesheets4::gs4_auth()
library('SpatialExperiment')
library('ggplot2')
library('gridExtra')
library('ggspavis')
id = 'V10B01-085_A1'
spe_path = '/dcs04/lieber/lcolladotor/spatialHPC_LIBD4035/spatial_hpc/processed-data/pilot_data_checks/spe_basic.Rdata'
################################################################################
# Function Definitions