--- title: "GerminaR" output: rmarkdown::html_vignette link-citations: true colorlinks: yes bibliography: [files/book.bib, files/pkgs.bib] csl: https://www.zotero.org/styles/apa vignette: > %\VignetteIndexEntry{GerminaR} %\VignetteEncoding{UTF-8} %\VignetteEngine{knitr::rmarkdown} editor_options: chunk_output_type: console --- ```{r setup, include=FALSE} source("https://raw.githubusercontent.com/Flavjack/inti/master/pkgdown/favicon/docs.r") ``` GerminaR is a platform base in open source package to calculate and graphic the main germination indices in R. GerminaR include a web application called “GerminQuant for R” for interactive analysis. ```{=html} ``` Analysis for the germination experiment can follow a routine. The functions will de explain according to the data set included in the GerminaR package: "*prosopis*". 1. Install and load the GerminaR package. Load the "*prosopis*" dataset on your session. In case of using another dataset, you can load your own data and proceed according to the following script: ```{r, echo=TRUE} # Install packages and dependencies library(GerminaR) library(dplyr) # load data fb <- prosopis %>% mutate(across(c(nacl, temp, rep), as.factor)) # Prosopis data set fb %>% head(10) %>% kable(caption = "Prosopis dataset") ``` 2. Calculate the germination indices and perform the ANOVA and the mean comparison tests. The user can generate the graphs, expressing their results, which can be either of bars or lines graphics. ```{r, echo=TRUE} # germination analysis (ten variables) gsm <- ger_summary(SeedN = "seeds" , evalName = "D" , data = fb ) # Prosopis data set processed gsm %>% head(10) %>% mutate(across(where(is.numeric), ~round(., 2))) %>% kable(caption = "Function ger_summary performe ten germination indices") ``` # Punctual analysis of germination ## Germination percentage ```{r, echo=TRUE, fig.cap="Germination experiment with *Prosopis juliflor* under different osmotic potentials and temperatures. Bar graph with germination percentage in a factorial analisys"} ## Germination Percentage (GRP) # analysis of variance av <- aov(grp ~ nacl*temp + rep, data = gsm) # mean comparison test mc_grp <- ger_testcomp(aov = av , comp = c("temp", "nacl") , type = "snk" ) # data result mc_grp$table %>% kable(caption = "Germination percentage mean comparision") # bar graphics for germination percentage grp <- mc_grp$table %>% fplot(data = . , type = "bar" , x = "temp" , y = "grp" , group = "nacl" , ylimits = c(0, 120, 30) , ylab = "Germination ('%')" , xlab = "Temperature" , glab = "NaCl (MPa)" , error = "ste" , sig = "sig" , color = F ) grp ``` ## Mean germination time ```{r, echo=TRUE, fig.cap="Germination experiment with *Prosopis juliflor* under different osmotic potentials and temperatures. Bar graph for mean germination time in a factorial analisys."} ## Mean Germination Time (MGT) # analysis of variance av <- aov(mgt ~ nacl*temp + rep, data = gsm) # mean comparison test mc_mgt <- ger_testcomp(aov = av , comp = c("temp", "nacl") , type = "snk") # data result mc_mgt$table %>% kable(caption = "Mean germination time comparison") # bar graphics for mean germination time mgt <- mc_mgt$table %>% fplot(data = . , type = "bar" , x = "temp" , y = "mgt" , group = "nacl" , ylimits = c(0,10, 1) , ylab = "Mean germination time (days)" , xlab = "Temperature" , glab = "NaCl (MPa)" , sig = "sig" , error = "ste" , color = T ) mgt ``` > You can add at each plot different arguments as the standard error, significance of the mean test, color, labels and limits. The resulted graphics are performed for publications and allows to insert math expression in the titles. # Cumulative analysis of germination The cumulative analysis of the germination allows to observe the evolution of the germination process, being able to be expressed as the percentage of germination or with the relative germination. ## In time analysis for NaCl ```{r, echo=TRUE, fig.cap="Germination experiment with *Prosopis juliflor* under different osmotic potentials and temperatures. Line graph from cumulative germination under different osmotic potentials."} # data frame with percentage or relative germination in time by NaCl git <- ger_intime(Factor = "nacl" , SeedN = "seeds" , evalName = "D" , method = "percentage" , data = fb ) # data result git %>% head(10) %>% kable(caption = "Cumulative germination by nacl factor") # graphic germination in time by NaCl nacl <- git %>% fplot(data = . , type = "line" , x = "evaluation" , y = "mean" , group = "nacl" , ylimits = c(0, 110, 10) , ylab = "Germination ('%')" , xlab = "Day" , glab = "NaCl (MPa)" , color = T , error = "ste" ) nacl ``` ## In time analysis for temperature ```{r, echo=TRUE, fig.cap="Germination experiment with *Prosopis juliflor* under different osmotic potentials and temperatures. Line graph from cumulative germination under different temperatures."} # data frame with percentage or relative germination in time by temperature git <- ger_intime(Factor = "temp" , SeedN = "seeds" , evalName = "D" , method = "percentage" , data = fb) # data result git %>% head(10) %>% kable(caption = "Cumulative germination by temperature factor") # graphic germination in time by temperature temp <- git %>% fplot(data = . , type = "line" , x = "evaluation" , y = "mean" , group = "temp" , ylimits = c(0, 110, 10) , ylab = "Germination ('%')" , xlab = "Day" , glab = "Temperature" , color = F ) temp ``` # Using ggplot2 As the function `fplot()` is build using [ggplot2](https://ggplot2.tidyverse.org/) [@R-ggplot2]. You can add more arguments for modify the graphics adding `+`. ```{r, echo=TRUE} library(ggplot2) git <- ger_intime(Factor = "temp" , SeedN = "seeds" , evalName = "D" , method = "percentage" , data = fb ) ggplot <- git %>% fplot(data = . , type = "line" , x = "evaluation" , y = "mean" , group = "temp" , ylimits = c(0, 110, 10) , ylab = "Germination ('%')" , xlab = "Day" , glab = "Temperature" , color = T ) + scale_x_continuous(n.breaks = 10, limits = c(0, 11)) ggplot ``` # References {-}
```{r references} if(!file.exists("files/pkgs.bib")){write_bib(c(.packages()),'files/pkgs.bib')} ```