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:

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.

##test with Github

paste("Hello", "World!") 
## [1] "Hello World!"
##load libraries
library("tidyverse") #data manipulation and plotting
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.4
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ ggplot2   3.4.4     ✔ tibble    3.2.1
## ✔ lubridate 1.9.3     ✔ tidyr     1.3.0
## ✔ purrr     1.0.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
#read in my data
GardenOzone <- read.csv("data/GardenOzone.csv")

#Look at the data
str(GardenOzone)
## 'data.frame':    20 obs. of  3 variables:
##  $ Ozone          : num  61.7 64 72.4 56.8 52.4 44.8 70.4 67.6 68.8 53.7 ...
##  $ Garden.location: chr  "West" "West" "West" "West" ...
##  $ Garden.ID      : chr  "G1" "G2" "G3" "G4" ...
head(GardenOzone)
##   Ozone Garden.location Garden.ID
## 1  61.7            West        G1
## 2  64.0            West        G2
## 3  72.4            West        G3
## 4  56.8            West        G4
## 5  52.4            West        G5
## 6  44.8            West        G6
#make a plot
ggplot(GardenOzone, aes(x= Ozone, fill = Garden.location))+
  geom_histogram(bins = 8, colour = "black") +
    theme_bw() +
  facet_wrap(~Garden.location, ncol =1)

#grouping by Garden.location will give the difference between East and West
GardenOzone %>%
    group_by(Garden.location)%>%
  summarise(meanOzone = mean(Ozone),
            varOzone = var(Ozone))
## # A tibble: 2 × 3
##   Garden.location meanOzone varOzone
##   <chr>               <dbl>    <dbl>
## 1 East                 77.3     62.0
## 2 West                 61.3     82.1