Skip to content

Commit

Permalink
size script small edit
Browse files Browse the repository at this point in the history
  • Loading branch information
SamGurr committed Oct 3, 2024
1 parent 1c977e7 commit 146e352
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 40 deletions.
68 changes: 34 additions & 34 deletions RAnalysis/Scripts/.Rhistory
Original file line number Diff line number Diff line change
@@ -1,37 +1,3 @@
# str(df)
# number of runs
unique(df$Generation) # 1, 2, and 3
Rep_Summary_all <- df %>% dplyr::select(c(Generation, Age, Parent_pCO2, Larvae_pCO2)) %>%
dplyr::group_by_all() %>%
dplyr::summarise(n=n())
# print the runs
# summary:
Rep_Summary_G1 <- Rep_Summary_all %>% dplyr::filter(Generation %in% 1) #
Rep_Summary_G1 %>% kbl() %>% kable_classic(full_width = F, html_font = "Cambria")
Rep_Summary_G2 <- Rep_Summary_all %>% dplyr::filter(Generation %in% 2) #
Rep_Summary_G2 %>% kbl() %>% kable_classic(full_width = F, html_font = "Cambria")
Rep_Summary_G3 <- Rep_Summary_all %>% dplyr::filter(Generation %in% 3) #
Rep_Summary_G3 %>% kbl() %>% kable_classic(full_width = F, html_font = "Cambria")
df_Exp2 <- df%>%
filter(Generation=="1") %>% dplyr::mutate(Experiment = 2)
df_Exp4 <- df%>%
filter(Generation=="2") %>% dplyr::mutate(Experiment = 4)
df_Exp6 <- df%>%
filter(Generation=="3") %>% dplyr::mutate(Experiment = 6)
# create new columns for live and dead based on the count and proportion (of alive) to back calculate dead - these are integers!
df_Exp6 <- df_Exp6 %>%
dplyr::mutate(Count =
as.numeric(gsub(",","",Count))) %>% # remove the commas from these numbers- id as character if not removed!
dplyr::rename(Count_alive = Count) %>% # rename to avoid confusion
dplyr::mutate(proportion = Percent_Survival/100,
Count_total = case_when(proportion == 0 ~ 0,
proportion >0 ~
(1/as.numeric(proportion))*
as.numeric(Count_alive)),# proportion is that of alive
Count_dead = Count_total - Count_alive)
# create new columns for live and dead based on the count and proportion (of alive) to back calculate dead - these are integers!
df_Exp6 <- df_Exp6 %>%
dplyr::mutate(Count =
as.numeric(gsub(",","",Count))) %>% # remove the commas from these numbers- id as character if not removed!
dplyr::rename(Count_alive = Count) %>% # rename to avoid confusion
dplyr::mutate(proportion = Percent_Survival/100,
Expand Down Expand Up @@ -510,3 +476,37 @@ tbl_regression(exp = TRUE)
Exp6_coxph_test_table_3
Exp6_hazardratio_plot_3 <- ggforest(Exp6_coxph_test_3, data = binary_Exp6_larvae)
Exp6_hazardratio_plot_3
knitr::opts_chunk$set(echo = TRUE)
# SET WORKING DIRECTORY
#knitr::opts_knit$set(root.dir = "C:/Users/samjg/Documents/Github_repositories/EAD-ASEB-Airradians_Larvae_crossgen_OA/RAnalysis") # Sam's
# knitr::opts_knit$set(root.dir =
# "C:/Users/samjg/Documents/Github_repositories/EAD-ASEB-Airradians_Larvae_crossgen_OA/RAnalysis/") # Sam's work
knitr::opts_knit$set(root.dir =
"C:/Users/samuel.gurr/Documents/Github_repositories/EAD-ASEB-Airradians_Larvae_crossgen_OA/RAnalysis/") # Sam's work
# install.packages('gcookbook')
# LOAD PACKAGES :::::::::::::::::::::::::::::::::::::::::::::::::::::::
library(dplyr)
library(ggplot2)
# install.packages('gcookbook')
# LOAD PACKAGES :::::::::::::::::::::::::::::::::::::::::::::::::::::::
library(dplyr)
library(ggplot2)
library(reshape2)
# install.packages('gcookbook')
# LOAD PACKAGES :::::::::::::::::::::::::::::::::::::::::::::::::::::::
library(dplyr)
library(ggplot2)
library(reshape2)
library(knitr)
library(car)
library(gcookbook)
library(ggpubr)
# LOAD DATA :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# 8.16/2025 shannon assembled a means and SD dataset for the DIC+TA to calculate
CarbChem_Meseck_means <- read.csv(file="Data/Seawater_chemistry/raw/Seawater_Chemsitry_means_Meseck_20240816.csv",
header=TRUE) # load the chem data
# This is all the data, we can back calculate to get to what Shannon assembled or just use the one above..
# if we come toa conclusion that TA+pH or pH+DIC is desired than we can do that
CarbChem_all <- read.csv(file="Data/Seawater_chemistry/raw/Seawater_Chemsitry_raw.csv",
header=TRUE) # load the chem data
CarbChem_Meseck_means
13 changes: 7 additions & 6 deletions RAnalysis/Scripts/Size.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ output: html_document
knitr::opts_chunk$set(echo = TRUE)
# SET WORKING DIRECTORY
#knitr::opts_knit$set(root.dir = "C:/Users/katherine.mcfarland/Documents/GitHub/EAD-ASEB-Airradians_Larvae_crossgen_OA/RAnalysis") # Katie's
knitr::opts_knit$set(root.dir = "C:/Users/samjg/Documents/Github_repositories/EAD-ASEB-Airradians_Larvae_crossgen_OA/RAnalysis") # Sam's
#knitr::opts_knit$set(root.dir = "C:/Users/samuel.gurr/Documents/Github_repositories/EAD-ASEB-Airradians_Larvae_crossgen_OA/RAnalysis") # Sam's work
#knitr::opts_knit$set(root.dir = "C:/Users/samjg/Documents/Github_repositories/EAD-ASEB-Airradians_Larvae_crossgen_OA/RAnalysis") # Sam's
knitr::opts_knit$set(root.dir = "C:/Users/samuel.gurr/Documents/Github_repositories/EAD-ASEB-Airradians_Larvae_crossgen_OA/RAnalysis") # Sam's work
```


Expand All @@ -34,7 +34,7 @@ library(nlme)
library(lme4)
library(multcomp)
library(Matrix)
?Matrix
```


Expand Down Expand Up @@ -805,6 +805,9 @@ lme_Exp4.emmeans.Age.letters <- multcomp::cld(object = lme_Exp4.emmeans.Age$emme
library(DHARMa)
# (2) GLMMs
library(lmerTest) # otherwise lme4 does not report table
hist(Exp2_GLMMs$Length)
# (2.1) All treatment Low, moderate, and high
Exp2_GLMMs <- Exp2 %>%
Expand All @@ -818,9 +821,7 @@ str(Exp2_GLMMs)
# RUN STATISTICAL MODEL ::::::::::::::::::::::::::::::::::
library(nlme)
library(lme4)
library(lmerTest) # otherwise lme4 does not report table
hist(Exp2_GLMMs$Length)
library(Matrix)
# adjust a difference in two proportions for confounders:
# to do so, you would run a logistic GLM with identity link.
Expand Down

0 comments on commit 146e352

Please sign in to comment.