From 7cc4a1a5ad0b79a45dcea22afb2659f8824d90b0 Mon Sep 17 00:00:00 2001
From: Svajunas Plunge <svajunas@retwod.sggw.pl>
Date: Tue, 13 Jun 2023 15:55:02 +0200
Subject: [PATCH] fixed nitrogen, phosphorus stress mixup in prepare_stress
 function

---
 R/plot_mgt_harv.R | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/R/plot_mgt_harv.R b/R/plot_mgt_harv.R
index 02f53b8..c73ec37 100644
--- a/R/plot_mgt_harv.R
+++ b/R/plot_mgt_harv.R
@@ -349,12 +349,11 @@ prepare_stress <- function(mgt_out, years) {
 
   stress <- bind_rows(stress_mono, stress_rota) %>%
     set_names(c('crop', 'water', 'aeration',
-                'temperature', 'nitrogen', 'phosphorus')) %>%
+                'temperature', 'phosphorus', 'nitrogen')) %>%
     pivot_longer(., cols = - crop, names_to = 'stress', values_to = 'var') %>%
     mutate(., stress = factor(stress,
                               levels = c('water', 'aeration', 'temperature',
-                                         'nitrogen', 'phosphorus')))
-
+                                         'phosphorus', 'nitrogen')))
   return(stress)
 }
 
-- 
GitLab