setwd("~/Library/CloudStorage/GoogleDrive-icarounam@gmail.com/Mi unidad/Agrosavia/Colaboraciones/René/1er_Cd/data")
library(Plasticity)
library(agricolae)
library(Rmisc)
## Loading required package: lattice
## Loading required package: plyr
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.1.2
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:plyr':
##
## arrange, count, desc, failwith, id, mutate, rename, summarise,
## summarize
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(ggplot2)
library(psych)
##
## Attaching package: 'psych'
## The following objects are masked from 'package:ggplot2':
##
## %+%, alpha
library(FSA)
## ## FSA v0.9.1. See citation('FSA') if used in publication.
## ## Run fishR() for related website and fishR('IFAR') for related book.
##
## Attaching package: 'FSA'
## The following object is masked from 'package:psych':
##
## headtail
## The following object is masked from 'package:plyr':
##
## mapvalues
library(forcats)
## Warning: package 'forcats' was built under R version 4.1.2
library(Hmisc)
## Warning: package 'Hmisc' was built under R version 4.1.2
##
## Attaching package: 'Hmisc'
## The following object is masked from 'package:psych':
##
## describe
## The following objects are masked from 'package:dplyr':
##
## src, summarize
## The following objects are masked from 'package:plyr':
##
## is.discrete, summarize
## The following objects are masked from 'package:base':
##
## format.pval, units
library("PerformanceAnalytics")
## Loading required package: xts
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
##
## Attaching package: 'xts'
## The following objects are masked from 'package:dplyr':
##
## first, last
##
## Attaching package: 'PerformanceAnalytics'
## The following objects are masked from 'package:agricolae':
##
## kurtosis, skewness
## The following object is masked from 'package:graphics':
##
## legend
library(onewaytests)
## Registered S3 methods overwritten by 'car':
## method from
## hist.boot FSA
## confint.boot FSA
##
## Attaching package: 'onewaytests'
## The following object is masked from 'package:Hmisc':
##
## describe
## The following object is masked from 'package:psych':
##
## describe
library(emmeans)
library(ggthemes)
library(multcompView)
library(RColorBrewer)
library(correlation)
## Warning: package 'correlation' was built under R version 4.1.2
##
## Attaching package: 'correlation'
## The following object is masked from 'package:agricolae':
##
## correlation
library(tibble)
## Warning: package 'tibble' was built under R version 4.1.2
library(fmsb)
## Warning: package 'fmsb' was built under R version 4.1.2
##Reading data
clones <- read.table("sensors.csv", header=T, sep=",")
# Assigning some variables to factors
clones$gen<-as.factor(clones$gen)
clones$curva<-as.factor(clones$curva)
clones$dia<-as.factor(clones$dia)
clones$rep<-as.factor(clones$rep)
clones$gendia<-as.factor(clones$gendia)
## Generando bases de datos para los tiempos a evaluar
clones.5 <- filter(clones, clones$dia == "5")
clones.6 <- filter(clones, clones$dia == "6")
##Quitando los tiempos no utilizados
clones.5.fin <- droplevels(clones.5)
clones.6.fin <- droplevels(clones.6)
##Convirtiendo a factor los genotipos y ambientes
#genotipos
clones.5.fin$gen<-as.factor(clones.5.fin$gen)
clones.6.fin$gen<-as.factor(clones.6.fin$gen)
#ambientes
clones.5.fin$curva<-as.factor(clones.5.fin$curva)
clones.6.fin$curva<-as.factor(clones.6.fin$curva)
##Gráficos radar
# Data subsets by temperature ramp
senscurva1 <- subset(clones.6.fin, clones.6.fin$curva == "1")
senscurva2 <- subset(clones.6.fin, clones.6.fin$curva == "2")
senscurva3 <- subset(clones.6.fin, clones.6.fin$curva == "3")
#T3
# Seleccionando Curva 1
attach(senscurva1)
#plot T3
radar6<-group_by(senscurva1, gen) %>%
summarise_at(vars(amargo:verde), median, na.rm = TRUE) %>%
rename(Bitter=amargo, Astringent=astringente, Acid=acido, Cocoa=cacao,Fruity=frutal,
Floral=floral, Sweet=dulce, Nut=frutos.secos, Herbal=herbal, Humidity=humedad, Rancid = rancio, Violet = violeta, Green = verde) %>%
column_to_rownames(var = "gen") %>% head()
radar6 <-rbind(rep(7,10) , rep(0,10) , radar6)
radar6
## Bitter Astringent Acid Cocoa Fruity Floral Sweet Nut Herbal Humidity
## 1 7 7 7 7 7 7 7 7 7 7
## 2 0 0 0 0 0 0 0 0 0 0
## CCN 51 4 3 3 4 3 2 2 2 1 0
## ICS 95 5 3 3 6 3 2 2 2 1 1
## TCS 01 4 4 4 6 4 3 3 4 2 0
## Rancid Violet Green
## 1 7 7 7
## 2 0 0 0
## CCN 51 0 1 2
## ICS 95 0 1 1
## TCS 01 0 0 1
# Color vector
colors_border=c( rgb(0.2,0.5,0.5,0.9), rgb(0.8,0.2,0.5,0.9) , rgb(0.7,0.5,0.1,0.9) )
colors_in=c( rgb(0.2,0.5,0.5,0.4), rgb(0.8,0.2,0.5,0.4) , rgb(0.7,0.5,0.1,0.4) )
radarchart(radar6, axistype=1, seg = 7,
#custom polygon
pcol=colors_border , pfcol=colors_in , plwd=4 , plty=1,
#custom the grid
cglcol="grey", cglty=1, axislabcol="grey", caxislabels=seq(0,7,1), calcex=0.8, cglwd=0.8,
#custom labels
vlcex=0.8, )
legend(x=1.5, y=1, legend = rownames(radar6[-c(1,2),]), bty = "n", pch=20 , col=colors_in , cex=0.8, pt.cex=1)

#T1
# Seleccionando Curva 2
detach(senscurva1)
attach(senscurva2)
#plot T1
radar6<-group_by(senscurva2, gen) %>%
summarise_at(vars(amargo:verde), median, na.rm = TRUE) %>%
rename(Bitter=amargo, Astringent=astringente, Acid=acido, Cocoa=cacao,Fruity=frutal,
Floral=floral, Sweet=dulce, Nut=frutos.secos, Herbal=herbal, Humidity=humedad, Rancid = rancio, Violet = violeta, Green = verde) %>%
column_to_rownames(var = "gen") %>% head()
radar6 <-rbind(rep(7,10) , rep(0,10) , radar6)
radar6
## Bitter Astringent Acid Cocoa Fruity Floral Sweet Nut Herbal Humidity
## 1 7 7 7 7 7 7 7 7 7 7
## 2 0 0 0 0 0 0 0 0 0 0
## CCN 51 5 4 4 5 3 3 3 3 1 0
## ICS 95 4 3 2 4 2 1 2 2 1 0
## TCS 01 5 4 3 5 3 2 2 3 2 1
## Rancid Violet Green
## 1 7 7 7
## 2 0 0 0
## CCN 51 0 0 1
## ICS 95 0 0 2
## TCS 01 0 0 1
# Color vector
colors_border=c( rgb(0.2,0.5,0.5,0.9), rgb(0.8,0.2,0.5,0.9) , rgb(0.7,0.5,0.1,0.9) )
colors_in=c( rgb(0.2,0.5,0.5,0.4), rgb(0.8,0.2,0.5,0.4) , rgb(0.7,0.5,0.1,0.4) )
radarchart(radar6, axistype=1, seg = 7,
#custom polygon
pcol=colors_border , pfcol=colors_in , plwd=4 , plty=1,
#custom the grid
cglcol="grey", cglty=1, axislabcol="grey", caxislabels=seq(0,7,1), calcex=0.8, cglwd=0.8,
#custom labels
vlcex=0.8, )
legend(x=1.5, y=1, legend = rownames(radar6[-c(1,2),]), bty = "n", pch=20 , col=colors_in , cex=0.8, pt.cex=1)

#T2
# Seleccionando Curva 3
detach(senscurva2)
attach(senscurva3)
#plot T2
radar6<-group_by(senscurva3, gen) %>%
summarise_at(vars(amargo:verde), median, na.rm = TRUE) %>%
rename(Bitter=amargo, Astringent=astringente, Acid=acido, Cocoa=cacao,Fruity=frutal,
Floral=floral, Sweet=dulce, Nut=frutos.secos, Herbal=herbal, Humidity=humedad, Rancid = rancio, Violet = violeta, Green = verde) %>%
column_to_rownames(var = "gen") %>% head()
radar6 <-rbind(rep(7,10) , rep(0,10) , radar6)
radar6
## Bitter Astringent Acid Cocoa Fruity Floral Sweet Nut Herbal Humidity
## 1 7 7 7 7 7 7 7 7 7 7
## 2 0 0 0 0 0 0 0 0 0 0
## CCN 51 4 3 4 4 2 1 2 2 1 0
## ICS 95 4 4 3 4 2 1 2 2 1 2
## TCS 01 5 4 3 5 3 2 2 2 1 2
## Rancid Violet Green
## 1 7 7 7
## 2 0 0 0
## CCN 51 0 0 2
## ICS 95 0 0 2
## TCS 01 0 0 3
# Color vector
colors_border=c( rgb(0.2,0.5,0.5,0.9), rgb(0.8,0.2,0.5,0.9) , rgb(0.7,0.5,0.1,0.9) )
colors_in=c( rgb(0.2,0.5,0.5,0.4), rgb(0.8,0.2,0.5,0.4) , rgb(0.7,0.5,0.1,0.4) )
radarchart(radar6, axistype=1, seg = 7,
#custom polygon
pcol=colors_border , pfcol=colors_in , plwd=4 , plty=1,
#custom the grid
cglcol="grey", cglty=1, axislabcol="grey", caxislabels=seq(0,7,1), calcex=0.8, cglwd=0.8,
#custom labels
vlcex=0.8, )
legend(x=1.5, y=1, legend = rownames(radar6[-c(1,2),]), bty = "n", pch=20 , col=colors_in , cex=0.8, pt.cex=1)
