R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

##Call data into the variable NSC230CTA and view data
NSC230CTA <- read_csv("save - Sheet1 (2).csv")
## Rows: 31 Columns: 2
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): Treatment
## dbl (1): Rating
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
##Code to reorder groups
NSC230CTA$Treatment<- factor(NSC230CTA$Treatment,
                                 levels = c("Control",
                                            "EtOH 1%",
                                            "APAP 2.5mM",
                                            "EtOH 1% + APAP 2.5mM"))
##Box-plot is created, x and y axis are relabeled, error bars are added, and all treatment groups are relabeled to add appropriate spacing
  p <- ggplot (NSC230CTA, aes (x = NSC230CTA$Treatment, y = Rating)) + geom_boxplot ((aes (fill = Treatment))) + geom_point (color = "black") + geom_jitter() + labs ( x = "Treatment", y = "Rating (0-3)") + stat_boxplot(geom = "errorbar", width = 0.25) + theme_minimal()
p + scale_x_discrete(breaks=c("Control","EtOH 1%", "APAP 2.5mM","EtOH 1% + APAP 2.5mM"),
      labels=c("Control 
(n=4)", "EtOH 1% 
(n=9)", "APAP 2.5 mM 
(n=9)", "EtOH 1% + APAP 2.5 mM 
(n=9)"))

##One-way ANOVA test conducted to compare the means of all groups to determine if there is a statistically significant difference between them.
onewayanova <- aov(Rating ~ Treatment, data = NSC230CTA)
summary (onewayanova)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## Treatment    3  14.65   4.882   8.622 0.000355 ***
## Residuals   27  15.29   0.566                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##Post hoc t-test to examine exact differences between every pair of groups.
posthocs <- TukeyHSD (onewayanova, "Treatment")
posthocs
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Rating ~ Treatment, data = NSC230CTA)
## 
## $Treatment
##                                        diff        lwr        upr     p adj
## EtOH 1%-Control                 -1.75000000 -3.0110354 -0.4889646 0.0039581
## APAP 2.5mM-Control              -2.11111111 -3.3485737 -0.8736485 0.0004092
## EtOH 1% + APAP 2.5mM-Control    -2.10000000 -3.3182759 -0.8817241 0.0003598
## APAP 2.5mM-EtOH 1%              -0.36111111 -1.3617327  0.6395105 0.7576378
## EtOH 1% + APAP 2.5mM-EtOH 1%    -0.35000000 -1.3267938  0.6267938 0.7615630
## EtOH 1% + APAP 2.5mM-APAP 2.5mM  0.01111111 -0.9350546  0.9572768 0.9999878
##Call data into the variable Average_Vasculature and view data
Average_Vasculature<- read_csv("Average_Vasculature_5.csv")
## Rows: 31 Columns: 2
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): Treatment
## dbl (1): Average_Percent
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
##Code to reorder groups
Average_Vasculature$Treatment<- factor(Average_Vasculature$Treatment,
                                 levels = c("Control",
                                            "EtOH 1%",
                                            "APAP 2.5",
                                            "EtOH 1% + APAP 2.5"))
##Box-plot is created, x and y axis are relabeled, error bars are added, and all treatment groups are relabeled to add appropriate spacing
v<- ggplot (Average_Vasculature, aes (x = Average_Vasculature$Treatment, y = Average_Percent)) + geom_boxplot ((aes (fill = Treatment))) + geom_point (color = "black") + geom_jitter() + labs ( x = "Treatment", y = "GFP expression in Cranial Vascular Area (%)") + stat_boxplot(geom = "errorbar", width = 0.25) + theme_minimal()
v + scale_x_discrete(breaks=c("Control","EtOH 1%", "APAP 2.5","EtOH 1% + APAP 2.5"),
        labels=c("Control 
(n=4)", "EtOH 1% 
(n=9)", "APAP 2.5 mM 
(n=9)", "EtOH 1% + APAP 2.5 mM 
(n=9)"))

##One-way ANOVA test conducted to compare the means of all groups to determine if there is a statistically significant difference between them
onewayanova <- aov(Average_Percent ~ Treatment, data = Average_Vasculature)
summary (onewayanova)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## Treatment    3  815.8   271.9   13.53 1.41e-05 ***
## Residuals   27  542.6    20.1                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##Post hoc test to examine exact differences between every pair of groups
posthocs <- TukeyHSD (onewayanova, "Treatment")
posthocs
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Average_Percent ~ Treatment, data = Average_Vasculature)
## 
## $Treatment
##                                   diff        lwr        upr     p adj
## EtOH 1%-Control             -10.327972 -17.700056 -2.9558884 0.0036100
## APAP 2.5-Control            -12.956528 -20.328612 -5.5844440 0.0002817
## EtOH 1% + APAP 2.5-Control  -16.833528 -24.205612 -9.4614440 0.0000063
## APAP 2.5-EtOH 1%             -2.628556  -8.411694  3.1545828 0.6052759
## EtOH 1% + APAP 2.5-EtOH 1%   -6.505556 -12.288694 -0.7224172 0.0230660
## EtOH 1% + APAP 2.5-APAP 2.5  -3.877000  -9.660138  1.9061383 0.2797014