I’m trying to implement SPI and SPEI calculation index using SPEI package, but the function plot.spei() could not be found, like below.
I’m using R 4.2.2 version and this is the code:
library(dplyr)
library(SPEI)
library(readr)
data(wichita)
wichita$PET <- hargreaves(Tmin = wichita$TMIN,
Tmax = wichita$TMAX,
lat = -15.7801)
wichita$BAL <- wichita$PRCP - wichita$PET
SPEI <- spei(wichita$BAL, scale = 1)
plot.spei(SPEI)
#plot(SPEI)
Does anyone know if this function does not exist any more in this package?
>Solution :
You are probably using the last version of SPI (SPEI 1.8.0). In this version the plot.spi() has been rewritten based on ggplot2. If you run plot() function only, it would probably give you the same function. plot.spi() may be found in the older versions of the package. See here for the last NEWS of the package. Or you might install older versions of the package.
Hope it could helps
