## CD-1 PFOA/GenX gestational exposure and latent health outcomes study ## Week 17 Bruker ## Fat:lean and percent fat ## HAC 01/26/2020 (w/ QC data) ## Load packages (needs to be done every time R is opened) library(dplyr) library(lme4) library(ggplot2) library(multcomp) library(tidyverse) library(viridis) # Set your working directory (replace this example with your file folder destination) setwd("/Users/harliecope/Desktop/GenX:PFOA Study/GenX PFOA Mouse Study/GenXPFOA Study") # Read in your files x<- read_csv("~/Desktop/GenX:PFOA Study/GenX PFOA Mouse Study/QC Data Files/csv for R/Week17BrukerBarGraphGrams.csv") x$Group<-as.factor(x$Group) x$Group<-factor(c("Control", "0.2 mg/kg GenX", "1.0 mg/kg GenX", "2.0 mg/kg GenX", "0.1 mg/kg PFOA", "1.0 mg/kg PFOA"), levels=c("Control", "0.2 mg/kg GenX", "1.0 mg/kg GenX", "2.0 mg/kg GenX", "0.1 mg/kg PFOA", "1.0 mg/kg PFOA")) str(x) w17bruker<-x ### Statistical Analyses ## Statistical analysis ## Males w17m<-subset(w17bruker, Sex=="Male") w17f<-subset(w17bruker, Sex=="Female") w17mhf<-subset(w17m, Diet=="HFD") w17mlf<-subset(w17m, Diet=="LFD") w17fhf<-subset(w17f, Diet=="HFD") w17flf<-subset(w17f, Diet=="LFD") ##MHFD MHFDplot<-ggplot(w17mhf, aes(fill=Compartment, y=Grams, x=Group)) + geom_bar(position="stack", stat="identity") + scale_fill_viridis(discrete=TRUE, begin = 0.3, end = 0.8, option="magma")+ theme_bw()+ theme(axis.text=element_text(size=12), axis.text.x = element_text(angle = 45, hjust = 1)) print(MHFDplot + ggtitle("Male HFD")) ##MLFD MLFDplot<-ggplot(w17mlf, aes(fill=Compartment, y=Grams, x=Group)) + geom_bar(position="stack", stat="identity") + scale_fill_viridis(discrete=TRUE, begin = 0.3, end = 0.8, option="magma")+ theme_bw()+ theme(axis.text=element_text(size=12), axis.text.x = element_text(angle = 45, hjust = 1)) print(MLFDplot + ggtitle("Male LFD")) ##FHFD FHFDplot<-ggplot(w17fhf, aes(fill=Compartment, y=Grams, x=Group)) + geom_bar(position="stack", stat="identity")+ scale_fill_viridis(discrete=TRUE, begin = 0.3, end = 0.8, option="magma")+ theme_bw()+ theme(axis.text=element_text(size=12), axis.text.x = element_text(angle = 45, hjust = 1)) print(FHFDplot + ggtitle("Female HFD")) ##FLFD FLFDplot<-ggplot(w17flf, aes(fill=Compartment, y=Grams, x=Group)) + geom_bar(position="stack", stat="identity")+ scale_fill_viridis(discrete=TRUE, begin = 0.3, end = 0.8, option="magma")+ theme_bw()+ theme(axis.text=element_text(size=12), axis.text.x = element_text(angle = 45, hjust = 1)) print(FLFDplot + ggtitle("Female LFD"))