library(psych)
library(readxl)
library(ggplot2)
## 
## Attaching package: 'ggplot2'
## The following objects are masked from 'package:psych':
## 
##     %+%, alpha
library(lattice)

(avena_enfer <- read_excel("DATOSAVENA2.xlsx", 
    col_types = c("numeric", "numeric", "numeric", 
        "numeric", "numeric", "numeric", 
        "numeric", "numeric")))
## # A tibble: 36 × 8
##    MUES.AVENA PUNTO.M PLANTA HOJAS TALLOS SEVERIDAD.UP SEVERIDAD.DOWN INCIDENCIA
##         <dbl>   <dbl>  <dbl> <dbl>  <dbl>        <dbl>          <dbl>      <dbl>
##  1          1       1      1     3      5            0              5          1
##  2          1       1      2     4      7            9              7          1
##  3          1       1      3     3      4            0              4          1
##  4          1       2      1     3      7            2              4          1
##  5          1       2      2     4      5            1              4          1
##  6          1       2      3     4      4            3              9          1
##  7          1       3      1     4      4            2              0          1
##  8          1       3      2     3      5            0              0          0
##  9          1       3      3     3      4            0              2          1
## 10          1       4      1     4      5            0              3          1
## # ℹ 26 more rows
attach(avena_enfer)

# Número de hojas promedio por tallo:
psych::describe(HOJAS)
##    vars  n mean   sd median trimmed mad min max range  skew kurtosis   se
## X1    1 36 3.67 0.53      4    3.67   0   3   5     2 -0.12    -0.96 0.09
# Número de tallos por planta 
psych::describe(TALLOS)
##    vars  n mean   sd median trimmed  mad min max range skew kurtosis   se
## X1    1 36 4.64 0.96      5     4.6 1.48   3   7     4 0.55     0.15 0.16
# severidad de hoja de distal o superior y la hoja basal (respectivamente)
psych::describe(SEVERIDAD.UP)
##    vars  n mean   sd median trimmed  mad min max range skew kurtosis   se
## X1    1 36 1.28 1.75      1    0.97 1.48   0   9     9 2.51     8.02 0.29
psych::describe(SEVERIDAD.DOWN)
##    vars  n mean  sd median trimmed  mad min max range skew kurtosis   se
## X1    1 36 3.81 2.7      3     3.7 1.48   0   9     9 0.38    -1.03 0.45
## Gráficos de severidad 
  
    ggplot(data = avena_enfer) + 
  geom_point(aes(x = PUNTO.M, y = SEVERIDAD.UP, colour = "SEVERIDAD.UP")) + 
  geom_point(aes(x = PUNTO.M, y = SEVERIDAD.DOWN, colour = "SEVERIDAD.DOWN"))+
   guides(color = guide_legend(title = "SEVERIDAD")) + 
    ggtitle("Severidad escaldadura en avena")+
  xlab("Puntos de muestreo") + ylab("Severidad")+
       theme(plot.background = element_rect(fill = "gray86")) +
      geom_hline (yintercept = median (avena_enfer$SEVERIDAD.UP, na.rm=TRUE), color="cyan")+
      geom_hline (yintercept = median (avena_enfer$SEVERIDAD.DOWN, na.rm=TRUE), color="red")+
  scale_x_continuous(n.breaks = 12)