Skip to content

Instantly share code, notes, and snippets.

@juanchiem
Last active July 27, 2023 01:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juanchiem/645d21a90da184c9733fe3134ea225ed to your computer and use it in GitHub Desktop.
Save juanchiem/645d21a90da184c9733fe3134ea225ed to your computer and use it in GitHub Desktop.
ordenar_meses_summer_season
gruesa <- format(ISOdate(2000, c(6:12,1:3), 1), "%B")
tibble::tribble(
~sitio, ~pp_agosto, ~pp_septiembre, ~pp_octubre, ~pp_noviembre, ~pp_diciembre, ~pp_enero, ~pp_febrero, ~pp_marzo,
"CHASCOMUS", 0, 0, 14L, 22L, 30L, 52L, 27L, 94L,
"RIVERA", 0, 50, 48L, 109L, 15L, 158L, 25L, 85L
) |>
pivot_longer(contains("pp"),
names_prefix = "pp_") |>
group_by(sitio) |>
mutate(csum = cumsum(value)) |>
ungroup() |>
mutate(name = factor(name, levels = gruesa)) %>%
arrange(name) |>
ggplot() +
aes(x=name, y=csum, group=1) +
geom_line()+
facet_wrap("sitio") +
theme(axis.text.x = element_text(
angle = 45, hjust = 1, vjust = 1))
@juanchiem
Copy link
Author

image

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