Visualizing with {ggplot2} package

library(ggplot2)
# build a dataframe:
n=length(r99ptot.71.00)
dat<-data.frame(
  dens=c(r99ptot.71.00,r99ptot.61.90),     lines=rep(c("r99ptot.71.00","r99ptot.61.90"),each=n)
  )

ggplot(dat, aes(x = dens, fill = lines)) + geom_density(alpha = 0.5)
## Warning: Removed 4 rows containing non-finite values (stat_density).

How to analyse a specific period

We use the {dplyr} package to subset data and we build again the climdexInput object setting the argument max.missing.days=c(annual = 365,monthly = 31) in order to allow the computation. In fact, the climdexInput object built from subsetted dataset is composed of the complete time series, where the values of days outside the period of interest are set to NA.

library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
# Let's say June-July-August-September:
JJAS.daily <- filter(Chirps, month==6 | month==7 | month==8 | month==9)
## summary(JJAS.daily)


# Create a climdexInput object:
PREC <- JJAS.daily$prec

PREC.DATES <- as.PCICt(do.call(paste, JJAS.daily[,c("year","month", "day")]), 
                       format="%Y %m %d",cal="gregorian")

PREC.CLIMDEX <- climdexInput.raw(prec = PREC,
                                 prec.dates = PREC.DATES,
                                 base.range = c(1971,2000),
                                 northern.hemisphere = TRUE,
                                 max.missing.days = c(annual = 365,
                                                      monthly = 31))

climdex.r95ptot(PREC.CLIMDEX)
##     1981     1982     1983     1984     1985     1986     1987     1988 
## 123.9153  85.8389  28.2332  60.8925 193.8586  96.2591  56.4576 183.1738 
##     1989     1990     1991     1992     1993     1994     1995     1996 
##  93.7203   0.0000  35.4896 211.4968  87.8871 300.7150  34.2049  87.3719 
##     1997     1998     1999     2000     2001     2002     2003     2004 
##  92.8665 122.4810 124.6032  62.6685 139.2760  27.0517 177.0089  27.2312 
##     2005     2006     2007     2008     2009     2010     2011     2012 
## 144.9007 166.5927 250.5355 141.9651  55.8779 268.9372  33.7278 299.4028 
##     2013     2014     2015     2016     2017 
## 199.4926  57.4597 369.5718 215.1158  55.5294