-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path02_progresso.qmd
More file actions
181 lines (147 loc) · 4.18 KB
/
Copy path02_progresso.qmd
File metadata and controls
181 lines (147 loc) · 4.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
---
title: "02: Avanços no melhoramento do linho no Sul do Brasil: Resultados do Programa de Melhoramento NEPEM/UFSC"
---
```{r global_options, include = FALSE}
knitr::opts_chunk$set(cache = FALSE,
comment = "##",
collapse = TRUE,
warning = FALSE,
message = FALSE)
```
# Pacotes
```{r warning=FALSE, message=FALSE}
library(rio)
library(tidyverse)
library(ggpubr)
library(ggridges)
```
# Dados
```{r}
df <- import_list("data/progresso.xlsx")
df$`2024` <-
df$`2024` |>
filter(RGPLA > 1.5)
junto <-
bind_rows(df) |>
mutate(ANO = as.factor(ANO))
dfmean <-
junto |>
group_by(ANO) |>
summarise(across(AP:RGPLA, \(x){mean(x, na.rm = TRUE)})) |>
mutate(ANO = as.factor(ANO))
```
# Estatística descritiva
```{r}
junto |>
group_by(ANO) |>
summarise(
n = n(),
min = min(RGPLA, na.rm = TRUE),
max = max(RGPLA, na.rm = TRUE),
media = mean(RGPLA, na.rm = TRUE),
dp = sd(RGPLA, na.rm = TRUE),
cv = dp / media * 100
)
```
# Teste t
```{r}
# Calculate n per group
df_n <-
junto |>
group_by(ANO) |>
summarise(n = n(), .groups = 'drop')
box <-
ggplot(junto, aes(x = ANO, y = RGPLA))+
geom_boxplot(aes(fill = ANO),
outliers = FALSE) +
geom_jitter(width = 0.2, alpha = 0.15) +
stat_summary(fun = mean,
geom = "point",
shape = 5,
fill = "red",
size = 2,
stroke = 1) +
stat_compare_means(method = "t.test",
method.args = list(var.equal = TRUE),
comparisons = list(c("2022", "2023"),
c("2022", "2024"),
c("2023", "2024"))) +
geom_text(data = df_n,
aes(x = ANO, y = 0, label = paste0("n = ", n)),
color = "gray50",
nudge_y = -1,
inherit.aes = FALSE) +
ggthemes::theme_stata(base_size = 14) +
theme(axis.text.y = element_text(angle = 0),
axis.text.x = element_blank(),
axis.title.x = element_blank()) +
ylim(c(0, 10)) +
coord_flip() +
labs(x = "Ano de cultivo",
y = "Rendimento de grãos por planta (g)",
fill = "")
```
# Densidade
```{r}
dfmean <-
junto |>
group_by(ANO) |>
summarise(media = mean(RGPLA, na.rm = TRUE))
dfmean
dens <-
ggplot(junto, aes(x = RGPLA, y = ANO, group = ANO, fill = ANO)) +
geom_density_ridges(alpha = 0.7) +
xlim(c(0, 10)) +
geom_vline(data = dfmean,
aes(xintercept = media,
color = ANO),
show.legend = FALSE) +
ggthemes::theme_stata(base_size = 14) +
theme(axis.text.y = element_text(angle = 0)) +
labs(x = "Rendimento de grãos por planta (g)",
y = "Ano de cultivo",
fill = "")
library(patchwork)
box /dens +
plot_annotation(tag_levels = "a") +
plot_layout(guides = "collect",
heights = c(0.3, 0.7)) &
theme(legend.position = "bottom")
# ggsave("figs/ganho.jpg",
# width = 10,
# height = 6)
```
# Rendimento de Grãos
```{r}
df2024 <-
df$`2024` |>
mutate(check = ifelse(GEN == "ST_PIONEIRA", "Check", "Genótipos NEPEM"))
df2024 |>
group_by(check) |>
summarise(mean(RGPLA))
ggplot(df2024, aes(x = reorder(GEN, -RGPLA), y = RGPLA, fill = check)) +
geom_col(color = "black") +
facet_wrap(~TIPO,
scales = "free_x") +
geom_hline(yintercept = 4.17,
linetype = 2,
color = "red") +
scale_fill_manual(values = c("salmon", "#1AB281")) +
coord_radial(start = -0.5 * pi, end = 0.5 * pi, inner.radius = 0.3) +
scale_y_continuous(breaks = 0:6) +
ggthemes::theme_stata(base_size = 14) +
theme(panel.grid.major.x = element_line(),
plot.caption = element_text(hjust = 1, size = 12, face = "italic"),
plot.title = element_text(hjust = 0),
plot.subtitle = element_text(hjust = 0, size = 12, face = "italic")) +
labs(x = "",
y = "",
fill = "",
title = "Rendimento de grãos por planta (g) em genótipos de linhaça Marrom e Dourada",
subtitle = "Safra 2024",
caption = "Programa de Melhoramento NEPEM/UFSC")
```
# Section info
```{r}
sessionInfo()
```