Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

SPEI and SPI index calculation in R

I’m trying to implement SPI and SPEI calculation index using SPEI package, but the function plot.spei() could not be found, like below.

enter image description here

I’m using R 4.2.2 version and this is the code:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading