0

I am trying to develop Standardized Precipitation Index(SPI) using Wichita data provided in R for which I am using "SPEI" package. I can generate SPI figure, however, the quality is not good for publication. I found a very similar question asked here: How to format the x-axis of the hard coded plotting function of SPEI package in R?.

When I tried the code provided in the above link, I could generate good quality figure for SPEI but not for SPI. I had problem in the following line: dplyr::mutate(sign = ifelse(ET0_har >= 0, "pos", "neg")) of the code. My specific question is what should I use instead of "ET0_har" in order to generate SPI in the above line?

I would appreciate your input to generate SPI figure like provided in the above link. Here is my codes:

install.packages("SPEI")
library(SPEI)
data("wichita")
SPI1<-spi(wichita$PRCP,scale = 1, distribution = 'Gamma')
plot(SPI1)
MrFlick
  • 195,160
  • 17
  • 277
  • 295
Inception
  • 103
  • 2

1 Answers1

0

Change the line to:

dplyr::mutate(sign = ifelse(`Series 1` >= 0, "pos", "neg")) 

then it works.

Felix Phl
  • 383
  • 1
  • 13