coffee rust

Author

Karine Mesquita

Published

May 21, 2025

Apresentação

o conjunto de dados será o da ferrugem do café na Etiópia que está no arquivo de dados na nuvem.

Importar os dados

usaremos a função gsheet2tbl() do pacote [gsheet] para carregar os dados no ambiente

library(gsheet)
cr <- gsheet2tbl("https://docs.google.com/spreadsheets/d/1bq2N19DcZdtax2fQW9OHSGMR0X2__Z9T/edit?gid=1871397229#gid=1871397229")
cr
# A tibble: 405 × 13
    farm region zone       district      lon   lat altitude cultivar shade    
   <dbl> <chr>  <chr>      <chr>       <dbl> <dbl>    <dbl> <chr>    <chr>    
 1     1 SNNPR  Bench Maji Debub Bench  35.4  6.90     1100 Local    Sun      
 2     2 SNNPR  Bench Maji Debub Bench  35.4  6.90     1342 Mixture  Mid shade
 3     3 SNNPR  Bench Maji Debub Bench  35.4  6.90     1434 Mixture  Mid shade
 4     4 SNNPR  Bench Maji Debub Bench  35.4  6.90     1100 Local    Sun      
 5     5 SNNPR  Bench Maji Debub Bench  35.4  6.90     1400 Local    Sun      
 6     6 SNNPR  Bench Maji Debub Bench  35.4  6.90     1342 Mixture  Mid shade
 7     7 SNNPR  Bench Maji Debub Bench  35.4  6.90     1432 Mixture  Mid shade
 8     8 SNNPR  Bench Maji Debub Bench  35.4  6.90     1100 Local    Sun      
 9     9 SNNPR  Bench Maji Debub Bench  35.4  6.89     1400 Local    Sun      
10    10 SNNPR  Bench Maji Debub Bench  35.4  6.88     1342 Mixture  Mid shade
# ℹ 395 more rows
# ℹ 4 more variables: cropping_system <chr>, farm_management <chr>, inc <dbl>,
#   sev2 <dbl>

Visualizar os dados

usaremos a função datatable() do pacote [DT]

library(DT)
datatable(cr)

Gráficos

library(tidyverse)
cr |> 
  ggplot(aes(lon, lat))+
  geom_point()

#remotes::install_github("ropensci/rnaturalearthhires")
#remotes::install_github("ropensci/rnaturalearth")
library(rnaturalearth)
library(rnaturalearthhires)
#install.packages("sf")
library(sf)
#install.packages("earth")
library(earth)
ETH <- ne_states(country = "Ethiopia", 
                 returnclass = "sf")

library(tidyverse)
library(ggthemes)
library(ggspatial)

ggplot(ETH)+
  geom_sf(fill = "gray90")+
  geom_point(data = cr, aes(lon, lat, color = inc))+
  scale_color_viridis_c()+
  theme_minimal()+
  theme(legend.position = "bottom")+
  annotation_scale(location = "tl")+
  annotation_north_arrow(location = "br", which_north = "true")+
  labs(title = "Ferrugem do café na Etiópia", x = "longitude", y= "latitude", subtitle = "levantamento em fazendas", caption = "Fonte: Mesquita et al.(2025)", 
       color = "Incidencia (%)")

ggsave("mapa.Etiópia.png", bg = "white", width = 10)


#BR <- ne_countries(country = "Brazil", 
                 #  returnclass = "sf")
#BR |> 
 #ggplot()+
  #geom_sf(fill="gray90")

parte 2 da aula