Skip to content

Instantly share code, notes, and snippets.

@tamaracha
tamaracha / tone_audiogram.R
Created June 7, 2020 22:08
How to import printed tone audiograms in R and plot them with ggplot2
library(magrittr)
# Frequencies tested in tone audiograms
audiogram_frequencies <- c(0.125, 0.25, 0.5, 0.75, 1, 1.5, 2, 3, 4, 6, 8)
# Simulate hearing loss data in wide format
sample_df <- data.frame(
frequency = audiogram_frequencies,
air_right = sample(40:70, size = 11),
air_left = sample(50:90, size = 11),
bone_right = sample(0:30, size = 11),