Skip to content

Instantly share code, notes, and snippets.

@juanchiem
Last active April 20, 2022 20:19
Show Gist options
  • Save juanchiem/e31aba772955f5073455159dee469945 to your computer and use it in GitHub Desktop.
Save juanchiem/e31aba772955f5073455159dee469945 to your computer and use it in GitHub Desktop.
Manipulación de dataset conteniendo varias enfermedades / métricas para rápida exploración global
library(tidyverse)
wide <- read.csv("https://raw.githubusercontent.com/juanchiem/agro_data/master/multiple_dis_metric.csv",
sep = ",") %>% as.tibble()
wide
wide %>%
pivot_longer(
cols = contains("_"),
names_to="var",
values_to='val') %>%
separate(var, c('enf', 'metric'),
sep = '_', convert = TRUE)->long
long
long %>%
ggplot()+
aes(x=factor(trt), y=val)+
geom_point(aes(col=factor(bk)))+
facet_wrap(.~ enf*metric, scales = "free_y")+
stat_summary(fun = "mean", geom = "crossbar")
@juanchiem
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment