Below is a snippet of data I am working with.
Flu
Day Positive Total
1 2 2
2 1 3
3 2 5
4 0 5
5 3 8
6 4 12
7 7 19
8 8 27
9 9 36
10 15 41
I am trying to write a loop with an if/else statement to determine if the one value in the Positive column is either "Higher" or "Lower" than the previous value. Doing so would then create a new column named "Trend" and would populate the row accordingly with "Higher" or Lower"
{
if(Flu$Positive[i+1]>Covid$Positive[i]))
Trend = "Higher"
else
Trend = "Lower"
}