Warning: package 'drc' was built under R version 4.4.3
Loading required package: MASS
Attaching package: 'MASS'
The following object is masked from 'package:dplyr':
select
'drc' has been loaded.
Please cite R and 'drc' if used for a publication,
for references type 'citation()' and 'citation('drc')'.
Attaching package: 'drc'
The following objects are masked from 'package:stats':
gaussian, getInitial
modelo.lig<-drm(FvFm~temp, data =ligustrum, fct =LL.4())modelo.plat<-drm(FvFm~temp, data =platano, fct =LL.4())modelo.amora<-drm(FvFm~temp, data =amora, fct =LL.4())modelo.tropi<-drm(FvFm~temp, data =tropi, fct =LL.4())
Extrair T50 e T05
T50.lig<-ED(modelo.lig, 50, type ="relative", display =FALSE)T50.lig
Estimate Std. Error
e:1:50 47.44936 11.90219
T50.pla<-ED(modelo.plat, 50, type ="relative", display =FALSE)T50.pla
Estimate Std. Error
e:1:50 50.06463 1.359365
T50.amo<-ED(modelo.amora, 50, type ="relative", display =FALSE)T50.amo
Estimate Std. Error
e:1:50 39.79625 5.248662
T50.tro<-ED(modelo.tropi, 50, type ="relative", display =FALSE)T50.tro
Estimate Std. Error
e:1:50 54.87703 2.80379
#T05 <- ED(modelo, 5, type = "relative", display = FALSE)
ggplot()+geom_line(data =pred.lig, aes(x =temp, y =FvFm_pred), color ="#EA542F", size =1.2)+geom_point(data =ligustrum, aes(x =temp, y =FvFm), color ="black", size =2)+geom_vline(xintercept =T50.lig[1], linetype =2, color ="gray60")+annotate("text", x =T50.lig[1]+1, y =0.9, label ="T50", color ="gray60")+labs( title ="Curva de tolerância térmica - Ligustrum", x ="Temperatura (°C)", y =expression(F[v]/F[m]))+theme_minimal()
Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
ℹ Please use `linewidth` instead.
ggplot()+geom_line(data =pred.pla, aes(x =temp, y =FvFm_pred), color ="#EA542F", size =1.2)+geom_point(data =platano, aes(x =temp, y =FvFm), color ="black", size =2)+geom_vline(xintercept =T50.pla[1], linetype =2, color ="gray60")+annotate("text", x =T50.pla[1]+1, y =0.9, label ="T50", color ="gray60")+labs( title ="Curva de tolerância térmica - Platano", x ="Temperatura (°C)", y =expression(F[v]/F[m]))+theme_minimal()
ggplot()+geom_line(data =pred.amo, aes(x =temp, y =FvFm_pred), color ="#EA542F", size =1.2)+geom_point(data =amora, aes(x =temp, y =FvFm), color ="black", size =2)+geom_vline(xintercept =T50.amo[1], linetype =2, color ="gray60")+annotate("text", x =T50.amo[1]+1, y =0.9, label ="T50", color ="gray60")+labs( title ="Curva de tolerância térmica - Amora", x ="Temperatura (°C)", y =expression(F[v]/F[m]))+theme_minimal()
ggplot()+geom_line(data =pred.tro, aes(x =temp, y =FvFm_pred), color ="#EA542F", size =1.2)+geom_point(data =tropi, aes(x =temp, y =FvFm), color ="black", size =2)+geom_vline(xintercept =T50.tro[1], linetype =2, color ="gray60")+annotate("text", x =T50.tro[1]+1, y =0.9, label ="T50", color ="gray60")+labs( title ="Curva de tolerância térmica - Ligustrum", x ="Temperatura (°C)", y =expression(F[v]/F[m]))+theme_minimal()
Source Code
---title: "T50 curves"author: "Marina Scalon"title-block-banner: trueformat: html: code-link: true code-tools: true theme: minty toc: true---## Working directory and packages```{r}setwd("C:/Marina/PDS/Curso Ecofisiologia/R")library(tidyverse)library(drc)```## Data organization```{r}dados <-read.csv("Termotolerancia.csv", sep=";")str(dados)dados2 <- dados %>%pivot_longer(cols=2:8, names_to ="temp", values_to="FvFm") %>%separate(Especie, c("sp", "ind"), sep="0") %>%mutate(FvFm =ifelse(FvFm>1,FvFm/1000, FvFm)) %>%mutate(temp =as.numeric(str_remove_all(temp, "X")))str(dados2)```## Filtrar espécies```{r}ligustrum <- dados2 %>%filter(sp=="Lig") %>%group_by(temp) %>%summarise(FvFm =mean(FvFm))platano <- dados2 %>%filter(sp=="Pl") %>%group_by(temp) %>%summarise(FvFm =mean(FvFm))amora <- dados2 %>%filter(sp=="Am") %>%group_by(temp) %>%summarise(FvFm =mean(FvFm))tropi <- dados2 %>%filter(sp=="Tr") %>%group_by(temp) %>%summarise(FvFm =mean(FvFm))```# Ajustar modelo logístico (curva térmica) ```{r}modelo.lig <-drm(FvFm ~ temp, data = ligustrum, fct =LL.4())modelo.plat <-drm(FvFm ~ temp, data = platano, fct =LL.4())modelo.amora <-drm(FvFm ~ temp, data = amora, fct =LL.4())modelo.tropi <-drm(FvFm ~ temp, data = tropi, fct =LL.4())```# Extrair T50 e T05 ```{r}T50.lig <-ED(modelo.lig, 50, type ="relative", display =FALSE)T50.ligT50.pla <-ED(modelo.plat, 50, type ="relative", display =FALSE)T50.plaT50.amo <-ED(modelo.amora, 50, type ="relative", display =FALSE)T50.amoT50.tro <-ED(modelo.tropi, 50, type ="relative", display =FALSE)T50.tro#T05 <- ED(modelo, 5, type = "relative", display = FALSE)```# Fazer predições para plotar ```{r}pred.lig <-data.frame(temp =seq(min(ligustrum$temp), max(ligustrum$temp), length.out =300))pred.lig$FvFm_pred <-predict(modelo.lig, newdata = pred.lig)pred.pla <-data.frame(temp =seq(min(platano$temp), max(platano$temp), length.out =300))pred.pla$FvFm_pred <-predict(modelo.plat, newdata = pred.pla)pred.amo <-data.frame(temp =seq(min(amora$temp), max(amora$temp), length.out =300))pred.amo$FvFm_pred <-predict(modelo.amora, newdata = pred.amo)pred.tro <-data.frame(temp =seq(min(tropi$temp), max(tropi$temp), length.out =300))pred.tro$FvFm_pred <-predict(modelo.tropi, newdata = pred.tro)```# Plotar a curva```{r}ggplot() +geom_line(data = pred.lig, aes(x = temp, y = FvFm_pred), color ="#EA542F", size =1.2) +geom_point(data = ligustrum, aes(x = temp, y = FvFm), color ="black", size =2) +geom_vline(xintercept = T50.lig[1], linetype =2, color ="gray60") +annotate("text", x = T50.lig[1]+1, y =0.9, label ="T50", color ="gray60") +labs(title ="Curva de tolerância térmica - Ligustrum",x ="Temperatura (°C)",y =expression(F[v]/F[m]) ) +theme_minimal()``````{r}ggplot() +geom_line(data = pred.pla, aes(x = temp, y = FvFm_pred), color ="#EA542F", size =1.2) +geom_point(data = platano, aes(x = temp, y = FvFm), color ="black", size =2) +geom_vline(xintercept = T50.pla[1], linetype =2, color ="gray60") +annotate("text", x = T50.pla[1]+1, y =0.9, label ="T50", color ="gray60") +labs(title ="Curva de tolerância térmica - Platano",x ="Temperatura (°C)",y =expression(F[v]/F[m]) ) +theme_minimal()``````{r}ggplot() +geom_line(data = pred.amo, aes(x = temp, y = FvFm_pred), color ="#EA542F", size =1.2) +geom_point(data = amora, aes(x = temp, y = FvFm), color ="black", size =2) +geom_vline(xintercept = T50.amo[1], linetype =2, color ="gray60") +annotate("text", x = T50.amo[1]+1, y =0.9, label ="T50", color ="gray60") +labs(title ="Curva de tolerância térmica - Amora",x ="Temperatura (°C)",y =expression(F[v]/F[m]) ) +theme_minimal()``````{r}ggplot() +geom_line(data = pred.tro, aes(x = temp, y = FvFm_pred), color ="#EA542F", size =1.2) +geom_point(data = tropi, aes(x = temp, y = FvFm), color ="black", size =2) +geom_vline(xintercept = T50.tro[1], linetype =2, color ="gray60") +annotate("text", x = T50.tro[1]+1, y =0.9, label ="T50", color ="gray60") +labs(title ="Curva de tolerância térmica - Ligustrum",x ="Temperatura (°C)",y =expression(F[v]/F[m]) ) +theme_minimal()```