Skip to content

Instantly share code, notes, and snippets.

View ctesta01's full-sized avatar
🌱

Christian Testa ctesta01

🌱
View GitHub Profile
@ctesta01
ctesta01 / mini_lit_review_on_open_science.md
Last active June 7, 2024 13:29
On the Value of a Culture of Open Science

On the Value of a Culture of Open Science

Here's a small handful of references I extracted from a combination of Google and Google Scholar searches on the value of developing a culture of open science.

LSE Impact Blog: The benefits of Open science are not inevitable: monitoring its development should be value-led

which is based on the draft paper, Monitoring Open Science as transformative change in research systems and has nice accompanying slides

PLOS Bio: Open science challenges, benefits and tips in early career and beyond

@ctesta01
ctesta01 / functional_programming_ID529.R
Created January 18, 2024 19:45
Intro to functional programming
# Functional Programming
# ID529
# Topics to cover
#
# - sapply, apply family
# - purrr::map
# - summarize
# - stratified models
#
@ctesta01
ctesta01 / id529_review_student_choice.R
Last active January 18, 2024 21:02
Review material for ID529 Students
# Let's Review
# We circulated a survey about what would be the most useful material for us to
# review and revisit, as well as if there are any questions that would be useful
# for us to go over together.
# Overall topics to try to cover:
#
# - dplyr and data manipulation
# - color in ggplot2
@ctesta01
ctesta01 / id529_core_script.R
Last active January 19, 2024 21:50
Core concepts for ID529
# ID529 Core Concepts Script
# This script covers the following skills:
# - Installing packages
# - Reading csv data in with readr::read_csv
# - Using dplyr for group_by and summarize
# - Creating factors, setting reference levels
# - Creating plots with ggplot2 and saving them
# - Fitting a model
# - Reporting on a model with gtsummary
@ctesta01
ctesta01 / create_and_read_encrypted_files.R
Last active July 31, 2023 15:29
Functions to create encrypted files with a password using openssl and prompting for password
#' Create Encrypted Files
create_encrypted_height_weight_medications <- function() {
# load files to be encrypted
dfs <-
list(
file1 = "sensitive_data/file1.xlsx",
file2 = "sensitive_data/file2.xlsx",
file3 = "sensitive_data/file3.xlsx"
) %>% purrr::map(readxl::read_excel)
@ctesta01
ctesta01 / literacy_rates_in_india.R
Created January 18, 2023 12:46
Reproducing a figure from Wikipedia
library(raster)
library(sf)
library(mapview)
library(janitor)
library(tidyverse)
library(RColorBrewer)
# google: get shapefiles for states of india in r
# results:
# - https://rstudio-pubs-static.s3.amazonaws.com/435552_5656a7fe6636474fb0f8d4222d79db2c.html
@ctesta01
ctesta01 / data.csv
Created January 13, 2023 16:17
A secret message! Level 3
msg X1 X2
msg1 0.0324862346463363 0.69194085852225
msg1 0.0394920482026479 0.677489436905826
msg1 0.0416296060991105 0.654030226700252
msg1 0.0438267683185091 0.638065001399384
msg1 0.0468689114781872 0.258300797649034
msg1 0.0479669631512071 0.682763302896725
msg1 0.0481195790287829 0.233654583287701
msg1 0.0498138500635324 0.62289798488665
msg1 0.0496950444726811 0.279729219143577
@ctesta01
ctesta01 / data.csv
Created January 13, 2023 16:01
A secret message! Level 2
1e-04 0.593445948405704
1e-04 0.580335382791219
1e-04 0.56737126037494
1e-04 0.516979202691876
0.000181832713359549 0.593445948405704
0.000181832713359549 0.56737126037494
0.000181832713359549 0.554553581156866
0.000181832713359549 0.516979202691876
0.000287949410139229 0.593445948405704
0.000287949410139229 0.554553581156866
@ctesta01
ctesta01 / data.csv
Last active January 13, 2023 15:54
A secret message! Level 1
-0.1137452711223203 0.8618811881188119
-0.1137452711223203 0.849009900990099
-0.1137452711223203 0.8361386138613861
-0.1137452711223203 0.8232673267326732
-0.1137452711223203 0.8103960396039603
-0.1137452711223203 0.7975247524752475
-0.1137452711223203 0.7846534653465346
-0.1137452711223203 0.7717821782178218
-0.1137452711223203 0.7589108910891089
-0.1137452711223203 0.6559405940594059
@ctesta01
ctesta01 / blue_orange_diverging_palette.R
Last active July 19, 2022 15:06
Example showing Blue/Orange Diverging Color Palette
library(sf)
library(ggplot2)
nc <- st_read(system.file("shapes/sids.shp", package="spData")[1], quiet=TRUE)
nc %>%
ggplot(aes(fill = AREA)) +
geom_sf(size = 0.05, color = 'white') +
scale_fill_gradientn(
colors = c("#DA8907", "#ECCD00", "white", "#62AEDC", "#203856"))