Skip to content

Instantly share code, notes, and snippets.

View ctesta01's full-sized avatar
🌱

Christian Testa ctesta01

🌱
View GitHub Profile
@ctesta01
ctesta01 / qsf_explanation.md
Last active April 4, 2024 07:44
How does a Qualtrics Survey File work?

Quickstart Guide to undertsanding the Qualtrics Survey File

This information is likely to quickly become outdated when Qualtrics next changes the formatting of the QSF file. This guide was started February 2017. I hope that it is a useful introduction to understanding the contents of the QSF file that one can download from Qualtrics.

This document includes:

@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 / 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 / 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 / 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 / recode_values.md
Last active July 10, 2023 10:08
Using Recode Values in Qualtrics

Using Recode Values in Qualtrics

Recode Values are used for different purposes depending on the question type in the Qualtrics platform. Below is a quick reference to what kinds of variables are available to be defined by the user in a given question type, and where they appear in the response set. The Recode Values are always numeric variables, and Question Export Tags can be set as strings. On the following pages are short explanations for each question type with some screenshots of the recode values menu in use and the output the example creates.

@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