# This tutorial shows you how to create a grouped bargraph.
# The data are DNA concentrations measured for the same specimens with a Nanodrop Spectrophotometer and Qubit 4 Fluorometer.
# The data file is available at: https://github.com/aguirrelab/r-tutorials
# The goal is to compare the DNA concentrations measured with these two devices.
# Open the ggplot2 package
library(ggplot2)
# Set the working directory.
# Note that you will have to change the path to the apprpriate directory for your computer.
setwd("C:/1awinz/R_work/bar_graph_tutorial")
# Open data file called "DNA_qbit_nnodrop_c.txt".
data3=read.table("DNA_qbit_nanodrop_c.txt", header=T)
attach(data3)
# Finally, create the grouped bargraph.
# Spec is the column with the specimen labels.
# DNA_conc indicates the DNA concentration measures.
ggplot(data=data3, aes(x=Spec, y=DNA_conc, fill=Type)) + geom_bar(stat="identity", position=position_dodge())+xlab("Specimen") + ylab("DNA Concentration (ng/ul)")+theme_classic()

#It should be clear that the Nanodrop consistently overestimates the sample DNA concentrations.