# install neccessary packages and load libraries
install.packages (c("tidyverse"))
library ("tidyverse")
# load dataframe and split by date variable
WissDat <- read.csv("Data.csv")
WissDat$Date <- ifelse (WissDat$Date == "23-Sep" & WissDat$Measurement == 0, "23-Sep (A)",
ifelse(WissDat$Date == "23-Sep" & WissDat$Measurement == 1, "23-Sep (B)", WissDat$Date))
WissDat.split <- split(WissDat, WissDat$Date)
July29 <- WissDat.split$`29-Jul`
July30 <- WissDat.split$`30-Jul`
Aug5 <- WissDat.split$`5-Aug`
Aug6 <- WissDat.split$`6-Aug`
Aug8 <- WissDat.split$`8-Aug`
Sept23a <- WissDat.split$`23-Sep (A)`
Sept23b <- WissDat.split$`23-Sep (B)`
Oct7 <- WissDat.split$`7-Oct`
May19 <- WissDat.split$`19-May`
May20 <- WissDat.split$`20-May`
# create colorblind friendly palette for plotting
cbp1 <- c("#D55E00", "#E69F00", "#56B4E9", "#0072B2","#F0E442","#009E73","#999999", "#CC79A7", "#999933")
Installing package into 'C:/Users/crist/Documents/R/win-library/4.0' (as 'lib' is unspecified)
package 'tidyverse' successfully unpacked and MD5 sums checked The downloaded binary packages are in C:\Users\crist\AppData\Local\Temp\Rtmpac9YzA\downloaded_packages
Warning message: "package 'tidyverse' was built under R version 4.0.5" -- Attaching packages ------------------------------------------------------------------------------- tidyverse 1.3.1 -- v ggplot2 3.3.5 v purrr 0.3.4 v tibble 3.1.0 v dplyr 1.0.5 v tidyr 1.1.3 v stringr 1.4.0 v readr 1.4.0 v forcats 0.5.1 Warning message: "package 'ggplot2' was built under R version 4.0.5" Warning message: "package 'tibble' was built under R version 4.0.5" Warning message: "package 'tidyr' was built under R version 4.0.5" Warning message: "package 'readr' was built under R version 4.0.5" Warning message: "package 'purrr' was built under R version 4.0.5" Warning message: "package 'dplyr' was built under R version 4.0.5" Warning message: "package 'stringr' was built under R version 4.0.5" Warning message: "package 'forcats' was built under R version 4.0.5" -- Conflicts ---------------------------------------------------------------------------------- tidyverse_conflicts() -- x dplyr::filter() masks stats::filter() x dplyr::lag() masks stats::lag()
# moisture by location plot for data collection on two days in July 2019
WissDat.Transect<- rbind(July29, July30)
options (repr.plot.width=14, repr.plot.height=10)
WissDat.Transect$DistJitter <- jitter(WissDat.Transect$Distance, amount = 5)
print (ggplot(WissDat.Transect, aes(x=DistJitter, y=Moisture, color=Date, shape=Date)) +
geom_point(size=6, alpha=.8) +
scale_x_reverse (name = "Distance (in meters) from bottom of hill", breaks = seq(0,200,25)) +
scale_y_continuous (breaks = seq(1, 2.2, .2), limits = c(1, 2.2)) +
scale_color_manual (values = cbp1) +
theme_minimal() +
ggtitle ("Soil Moisture by Location") +
theme (text = element_text(size=20),
axis.title.x = element_text(margin = margin(15,0,0,0)),
axis.title.y = element_text(margin = margin(0,15,0,0)),
panel.background = element_rect(fill = NA, color = "black"),
aspect.ratio = .6) )
# strength by location plot for data collection on two days in July 2019
options (repr.plot.width=14, repr.plot.height=10)
print (ggplot(WissDat.Transect, aes(x=DistJitter, y=Strength, color=Date, shape=Date)) +
geom_point(size=6, alpha=.8) +
scale_x_reverse (name = "Distance (in meters) from bottom of hill", breaks = seq(0,200,25)) +
scale_y_continuous (breaks = seq(1, 8.5, .5), limits = c(1, 8.5)) +
scale_color_manual (values = cbp1) +
theme_minimal() +
ggtitle ("Soil Strength by Location") +
theme (text = element_text(size=20),
axis.title.x = element_text(margin = margin(15,0,0,0)),
axis.title.y = element_text(margin = margin(0,15,0,0)),
panel.background = element_rect(fill = NA, color = "black"),
aspect.ratio = .6) )
# moisture by location plot that now includes data collection in September 2020
WissDat.Transect <- rbind(July29, July30, Sept23a, Sept23b)
WissDat.Transect$DistJitter <- ifelse(WissDat.Transect$Date == "29-Jul" | WissDat.Transect$Date == "30-Jul",
jitter(WissDat.Transect$Distance, amount = 5), WissDat.Transect$Distance)
WissDat.Transect$Date <- factor(WissDat.Transect$Date, levels = c("29-Jul", "30-Jul", "23-Sep (A)", "23-Sep (B)"))
alpha <- ifelse(WissDat.Transect$Date == "29-Jul" | WissDat.Transect$Date == "30-Jul", .25, .8)
options (repr.plot.width=14, repr.plot.height=10)
print (ggplot(WissDat.Transect, aes(x=DistJitter, y=Moisture, color=Date, shape=Date)) +
geom_point(size=6, alpha=alpha) +
scale_x_reverse (name = "Distance (in meters) from bottom of hill", breaks = seq(0,200,25)) +
scale_y_continuous (breaks = seq(1, 2.2, .2), limits = c(1, 2.2)) +
scale_color_manual (values = cbp1) +
scale_shape_manual (values = c(19,17,15,18)) +
theme_minimal() +
ggtitle ("Soil Moisture by Location") +
theme (text = element_text(size=20),
axis.title.x = element_text(margin = margin(15,0,0,0)),
axis.title.y = element_text(margin = margin(0,15,0,0)),
panel.background = element_rect(fill = NA, color = "black"),
aspect.ratio = .6) )
# strength by location plot that now includes data collection in September 2020
options (repr.plot.width=14, repr.plot.height=10)
print (ggplot(WissDat.Transect, aes(x=DistJitter, y=Strength, color=Date, shape=Date)) +
geom_point(size=6, alpha=alpha) +
scale_x_reverse (name = "Distance (in meters) from bottom of hill", breaks = seq(0,200,25)) +
scale_y_continuous (breaks = seq(1, 8.5, .5), limits = c(1, 8.5)) +
scale_color_manual (values = cbp1) +
scale_shape_manual (values = c(19,17,15,18)) +
theme_minimal() +
ggtitle ("Soil Strength by Location") +
theme (text = element_text(size=20),
axis.title.x = element_text(margin = margin(15,0,0,0)),
axis.title.y = element_text(margin = margin(0,15,0,0)),
panel.background = element_rect(fill = NA, color = "black"),
aspect.ratio = .6) )
# moisture by location plot that now includes data collection in October 2020
WissDat.Transect <- rbind(July29, July30, Sept23a, Sept23b, Oct7)
WissDat.Transect$DistJitter <- ifelse(WissDat.Transect$Date == "29-Jul" | WissDat.Transect$Date == "30-Jul" |
WissDat.Transect$Date == "7-Oct", jitter(WissDat.Transect$Distance,
amount = 5), WissDat.Transect$Distance)
WissDat.Transect$Date <- factor(WissDat.Transect$Date, levels = c("29-Jul", "30-Jul", "23-Sep (A)", "23-Sep (B)", "7-Oct"))
alpha <- ifelse(WissDat.Transect$Date == "7-Oct", .8, .3)
options (repr.plot.width=14, repr.plot.height=10)
print (ggplot(WissDat.Transect, aes(x=DistJitter, y=Moisture, color=Date, shape=Date)) +
geom_point(size=6, alpha=alpha) +
scale_x_reverse (name = "Distance (in meters) from bottom of hill", breaks = seq(0,200,25)) +
scale_y_continuous (breaks = seq(1, 2.2, .2), limits = c(1, 2.2)) +
scale_color_manual (values = cbp1) +
scale_shape_manual (values = c(19,17,15,18,19)) +
theme_minimal() +
ggtitle ("Soil Moisture by Location") +
theme (text = element_text(size=20),
axis.title.x = element_text(margin = margin(15,0,0,0)),
axis.title.y = element_text(margin = margin(0,15,0,0)),
panel.background = element_rect(fill = NA, color = "black"),
aspect.ratio = .6) )
# strength by location plot that now includes data collection in October 2020
options (repr.plot.width=14, repr.plot.height=10)
print (ggplot(WissDat.Transect, aes(x=DistJitter, y=Strength, color=Date, shape=Date)) +
geom_point(size=6, alpha=alpha) +
scale_x_reverse (name = "Distance (in meters) from bottom of hill", breaks = seq(0,200,25)) +
scale_y_continuous (breaks = seq(0.5, 8.5, .5), limits = c(0.5, 8.5)) +
scale_color_manual (values = cbp1) +
scale_shape_manual (values = c(19,17,15,18,19)) +
theme_minimal() +
ggtitle ("Soil Strength by Location") +
theme (text = element_text(size=20),
axis.title.x = element_text(margin = margin(15,0,0,0)),
axis.title.y = element_text(margin = margin(0,15,0,0)),
panel.background = element_rect(fill = NA, color = "black"),
aspect.ratio = .6) )
# moisture by location plot that now includes data collection in May 2022
WissDat.Transect <- rbind(July29, July30, Sept23a, Sept23b, Oct7, May19)
WissDat.Transect$DistJitter <- ifelse(WissDat.Transect$Date == "29-Jul" | WissDat.Transect$Date == "30-Jul" |
WissDat.Transect$Date == "7-Oct" | WissDat.Transect$Date == "19-May" , jitter(WissDat.Transect$Distance,
amount = 5), WissDat.Transect$Distance)
WissDat.Transect$Date <- factor(WissDat.Transect$Date, levels = c("29-Jul", "30-Jul", "23-Sep (A)", "23-Sep (B)", "7-Oct", "19-May"))
alpha <- ifelse(WissDat.Transect$Date == "19-May", .8, .3)
options (repr.plot.width=14, repr.plot.height=10)
print (ggplot(WissDat.Transect, aes(x=DistJitter, y=Moisture, color=Date, shape=Date)) +
geom_point(size=6, alpha=alpha) +
scale_x_reverse (name = "Distance (in meters) from bottom of hill", breaks = seq(0,200,25)) +
scale_y_continuous (breaks = seq(1, 2.2, .2), limits = c(1, 2.2)) +
scale_color_manual (values = cbp1) +
scale_shape_manual (values = c(19,17,15,18,19,17)) +
theme_minimal() +
ggtitle ("Soil Moisture by Location") +
theme (text = element_text(size=20),
axis.title.x = element_text(margin = margin(15,0,0,0)),
axis.title.y = element_text(margin = margin(0,15,0,0)),
panel.background = element_rect(fill = NA, color = "black"),
aspect.ratio = .6) )
# strength by location plot that now includes data collection in May 2022
options (repr.plot.width=14, repr.plot.height=10)
print (ggplot(WissDat.Transect, aes(x=DistJitter, y=Strength, color=Date, shape=Date)) +
geom_point(size=6, alpha=alpha) +
scale_x_reverse (name = "Distance (in meters) from bottom of hill", breaks = seq(0,200,25)) +
scale_y_continuous (breaks = seq(0.5, 8.5, .5), limits = c(0.5, 8.5)) +
scale_color_manual (values = cbp1) +
scale_shape_manual (values = c(19,17,15,18,19,17)) +
theme_minimal() +
ggtitle ("Soil Strength by Location") +
theme (text = element_text(size=20),
axis.title.x = element_text(margin = margin(15,0,0,0)),
axis.title.y = element_text(margin = margin(0,15,0,0)),
panel.background = element_rect(fill = NA, color = "black"),
aspect.ratio = .6) )