Code
# pkg
library(readxl)
library(tidyverse)
library(dplyr)
#function
# source(here::here("src/function/stat_function/stat_analysis_main.R")) # for make plot
# source("src/function/graph_function.R")
# pkg
library(readxl)
library(tidyverse)
library(dplyr)
#function
# source(here::here("src/function/stat_function/stat_analysis_main.R")) # for make plot
# source("src/function/graph_function.R")
=read_excel(here::here("data/physio/raw_data_physio/dataset_physio_soybean_xp1.xlsx"))
data_physio=read_excel(here::here("data/plant_information.xlsx"))
plant_info
=merge(data_physio,plant_info,by="plant_num",all=T)
global_physio
# Add scan surface #####################################
=read.csv(here::here("data/physio/raw_data_physio/result_nb_pixel_leaf_scan.csv"))
leaf_scan=read.csv(here::here("data/physio/raw_data_physio/result_nb_pixel_stem_scan.csv")) stem_scan
<- gregexpr("[0-9\\.]+" , leaf_scan$Label )
gr <- as.integer(t( sapply(regmatches(leaf_scan$Label , gr) , as.numeric)))
resultat $Label=resultat
leaf_scancolnames(leaf_scan)=c("plant_num","leaf_scan","X")
$leaf_scan=leaf_scan$leaf_scan*0.0063796*0.0063796
leaf_scan
<- gregexpr("[0-9\\.]+" , stem_scan$Label )
gr <- as.integer(t( sapply(regmatches(stem_scan$Label , gr) , as.numeric)))
resultat $Label=resultat
stem_scancolnames(stem_scan)=c("plant_num","stem_scan","X")
$stem_scan=stem_scan$stem_scan*0.0063796*0.0063796
stem_scan
=merge(stem_scan,leaf_scan,by="plant_num",all=T)
df_scan=df_scan%>%
df_scan::select("plant_num","leaf_scan","stem_scan")
dplyr
=merge(global_physio,df_scan,by="plant_num",all=T) global_physio
# Compilation in stem_area or leaf_area for planimeter and scan
=global_physio %>%rowwise() %>% mutate(leaf_area = ifelse(is.na(planimeter_leaf), leaf_scan, planimeter_leaf))
global_physio=global_physio %>%rowwise() %>% mutate(stem_area = ifelse(is.na(planimeter_stem), leaf_scan, planimeter_stem))
global_physio
# Replace0 by NA
$leaf_area[global_physio$leaf_area == 0] <- NA
global_physio$stem_area[global_physio$stem_area == 0] <- NA
global_physio
# Calculate SLA (specific leaf area)
# Tha variables calculated were area / mass of leaf in m²/kg , which is the ratio of leaf area (cm² to m²) by the leaf dry biomass (g to kg)
$SLA=(global_physio$leaf_area*0.0001)/(global_physio$weight_leaf*0.001)
global_physio
# Calculate the sum of the biomass
$sum_biomass=global_physio$weight_leaf+global_physio$weight_stem+global_physio$weight_root
global_physio
# Calculate the shoot_root_ratio
$shoot_root_ratio=(global_physio$weight_leaf+global_physio$weight_stem)/global_physio$weight_root
global_physio
# Convert Leaf Water Potential
$Hydric_potential=global_physio$Hydric_potential*-0.1 global_physio
=global_physio%>%
global_physio_select::select(Hydric_potential, weight_stem,weight_leaf,weight_root,weight_cotyledon,leaf_scan,leaf_area,stem_scan,stem_area,planimeter_leaf,planimeter_stem,SLA,sum_biomass,plant_num,shoot_root_ratio) dplyr
=read.csv(here::here("data/physio/raw_data_physio/result_licor.csv"))[2:23]
licor<- licor %>%
licor_h pivot_wider(names_from="parametre",
values_from="value")
=licor_h %>%
licor_h_select::select(plant_num,colnames(licor_h)[21:64])
dplyr
$plant_num=as.integer(plant_info$plant_num)
plant_info=merge(global_physio_select,licor_h_select, by="plant_num", all=T)
global_physio=merge(plant_info,global_physio,by="plant_num", all=T) global_physio
I delet Extrem outlier because problem in root biomass or extreme outlier in multiple analyses
=global_physio %>%
global_physio_cleanfilter(plant_num!=1113) %>%
filter(!plant_num %in% c(87))
write.csv2(global_physio_clean,here::here("data/physio/global_physio.csv"),row.names = F)