Last active
October 19, 2022 01:36
-
-
Save juanchiem/cd70dcb629c879cd4f5a5a8da244e760 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
dat <- tibble::tribble( | |
~precio_cereal, ~gasto_comer, ~ingreso_neto, ~`kg/$`, ~producto, ~costo_dosis, ~mosquito, ~costo_apli, ~rinde_obj, ~`pisada_%`, ~pisada_kg, ~costo_trat_kg, ~costo_tot_kg, | |
310L, 20L, 248, 4.03, "MD", 22L, 8.5, 30.5, 2500L, 2.5, 62.5, 123L, 185L, | |
310L, 20L, 248, 4.03, "MD", 22L, 8.5, 30.5, 3000L, 2.5, 75, 123L, 198L, | |
310L, 20L, 248, 4.03, "MD", 22L, 8.5, 30.5, 3500L, 2.5, 87.5, 123L, 210L, | |
310L, 20L, 248, 4.03, "MD", 22L, 8.5, 30.5, 4000L, 2.5, 100, 123L, 223L, | |
320L, 20L, 256, 3.91, "MD", 22L, 8.5, 30.5, 2500L, 2.5, 62.5, 119L, 182L, | |
320L, 20L, 256, 3.91, "MD", 22L, 8.5, 30.5, 3000L, 2.5, 75, 119L, 194L, | |
320L, 20L, 256, 3.91, "MD", 22L, 8.5, 30.5, 3500L, 2.5, 87.5, 119L, 207L, | |
320L, 20L, 256, 3.91, "MD", 22L, 8.5, 30.5, 4000L, 2.5, 100, 119L, 219L, | |
330L, 20L, 264, 3.79, "MD", 22L, 8.5, 30.5, 2500L, 2.5, 62.5, 116L, 178L, | |
330L, 20L, 264, 3.79, "MD", 22L, 8.5, 30.5, 3000L, 2.5, 75, 116L, 191L, | |
330L, 20L, 264, 3.79, "MD", 22L, 8.5, 30.5, 3500L, 2.5, 87.5, 116L, 203L, | |
330L, 20L, 264, 3.79, "MD", 22L, 8.5, 30.5, 4000L, 2.5, 100, 116L, 216L, | |
310L, 20L, 248, 4.03, "MT", 37L, 8.5, 45.5, 2500L, 2.5, 62.5, 183L, 246L, | |
310L, 20L, 248, 4.03, "MT", 37L, 8.5, 45.5, 3000L, 2.5, 75, 183L, 258L, | |
310L, 20L, 248, 4.03, "MT", 37L, 8.5, 45.5, 3500L, 2.5, 87.5, 183L, 271L, | |
310L, 20L, 248, 4.03, "MT", 37L, 8.5, 45.5, 4000L, 2.5, 100, 183L, 283L, | |
320L, 20L, 256, 3.91, "MT", 37L, 8.5, 45.5, 2500L, 2.5, 62.5, 178L, 240L, | |
320L, 20L, 256, 3.91, "MT", 37L, 8.5, 45.5, 3000L, 2.5, 75, 178L, 253L, | |
320L, 20L, 256, 3.91, "MT", 37L, 8.5, 45.5, 3500L, 2.5, 87.5, 178L, 265L, | |
320L, 20L, 256, 3.91, "MT", 37L, 8.5, 45.5, 4000L, 2.5, 100, 178L, 278L, | |
330L, 20L, 264, 3.79, "MT", 37L, 8.5, 45.5, 2500L, 2.5, 62.5, 172L, 235L, | |
330L, 20L, 264, 3.79, "MT", 37L, 8.5, 45.5, 3000L, 2.5, 75, 172L, 247L, | |
330L, 20L, 264, 3.79, "MT", 37L, 8.5, 45.5, 3500L, 2.5, 87.5, 172L, 260L, | |
330L, 20L, 264, 3.79, "MT", 37L, 8.5, 45.5, 4000L, 2.5, 100, 172L, 272L | |
) %>% | |
janitor::clean_names() | |
p <- dat %>% #names | |
ggplot()+ | |
aes(x=precio_cereal, y=costo_tot_kg, col=factor(rinde_obj))+ | |
geom_point()+ | |
geom_line()+ | |
facet_wrap("producto")+ | |
labs(col="Rinde objetivo (kg/ha)", | |
x = "Precio cereal - enero '23 (US$/Ton)", | |
y = "Costo tratamiento (kg/ha)", | |
caption = | |
"Pisada: 2.5% | |
Gastos de comercialización: 20% | |
MD-Mecla doble triazol + estrobi: 22 US$/dosis | |
MT-Mecla triple triazol + estrobi + carboxa: 37 US$/dosis") + | |
theme(legend.position = "top", legend.direction = "horizontal") | |
p | |
dat %>% | |
pivot_longer(cols = c(pisada_kg, costo_trat_kg)) %>% | |
ggplot()+ | |
aes(x = precio_cereal, y = value, fill = name, label = value) + | |
geom_bar(stat = "identity") + | |
geom_text(size = 3, position = position_stack(vjust = 0.5))+ | |
facet_grid(producto ~ rinde_obj)+ | |
labs(fill="Componentes costo", | |
x = "Precio cereal - enero '23 (US$/Ton)", | |
y = "Costo total tratamiento (kg/ha)", | |
caption = | |
"Pisada: 2.5% | |
Gastos de comercialización: 20% | |
MD-Mecla doble triazol + estrobi: 22 US$/dosis | |
MT-Mecla triple triazol + estrobi + carboxa: 37 US$/dosis") + | |
theme(legend.position = "top", legend.direction = "horizontal") | |
dat_resp <- tibble::tribble( | |
~`resp%`, ~rinde_obj, ~resp_abs, | |
2L, 2500L, 50L, | |
2L, 3000L, 60L, | |
2L, 3500L, 70L, | |
2L, 4000L, 80L, | |
4L, 2500L, 100L, | |
4L, 3000L, 120L, | |
4L, 3500L, 140L, | |
4L, 4000L, 160L, | |
6L, 2500L, 150L, | |
6L, 3000L, 180L, | |
6L, 3500L, 210L, | |
6L, 4000L, 240L, | |
8L, 2500L, 200L, | |
8L, 3000L, 240L, | |
8L, 3500L, 280L, | |
8L, 4000L, 320L | |
)%>% | |
janitor::clean_names() | |
dat_resp %>% | |
ggplot()+ | |
aes(rinde_obj, resp_abs, col= factor(resp_percent))+ | |
geom_point()+ | |
geom_line()+ | |
labs( | |
col="Cebada - Respuesta rinde (%)", | |
x = "Rinde objetivo (kg/ha)", | |
y = "Respuesta absoluta (kg/ha)", | |
caption = "Datos de ensayos no publicados. | |
Respuesta a fungicidas con baja presion de enfermedades en HB-1 y HB-2 | |
Campañas 2018 a 2021") + | |
theme(legend.position = "top", legend.direction = "horizontal") |
Author
juanchiem
commented
Oct 18, 2022
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment