Home •Search •Dr. Hain •Clinic website •Information for Dizzy Patients •Music •FLW • Various and Sundry
First we have to restructure our "wide" data to produce "long" data. This page shows how to do it for PTA.
This is what our long data looks like:
In R, there are 4 (yes 4) graphics systems. "Base" graphics are quick/dirty. There are 3 others, but we will focus on ggplot2.
This graph was produced using the following R code:
p<-ggplot(data=audio_sep, aes(x=DOS, y=value, fill=side)) +
scale_y_reverse(limits=c(100,0), breaks=seq(0,100,10) )+
labs(x="Date", y="dB") +
# geom_line()+ ## Draws lines between bars (not very useful).
# theme_minimal() + ## no box
theme_bw()+ ## puts box around plot.
facet_grid(side ~.) + ## When turned on, converts into two graphs.
# ggtitle(paste("PTA by ear for ", audio$LastName)) +
ggtitle("PTA for example data") +
|© Copyright May 3, 2021 , Timothy C. Hain, M.D. All rights reserved.|