Why, yes we can!!! (Sounds like an old campaign rally cry, but I digress...)
Instead of regex, I used rle() instead and did some playing around
with indices. It's a little tedious, but it seems to work. The basic
idea is to extract the subset of the series for which the index has
fallen from the previous quarter and do exactly the same thing with
the corresponding indices offset by 1 (so that we start at the top and
end at the bottom after we join the two data frames together). We then
create two ggplot layers: the first is of the entire series using
geom_path() and the second is of the subset of falling GDPs using
geom_segment() in a different color. I used the series from Rob
Hyndman's web site since the help page lied about the start and end of
the series :)
The entire code is attached as a file since it's a bit long for a
post. I'm sure it can be tidied up a bit.
Dennis
> --
> --
> You received this message because you are subscribed to the ggplot2 mailing
> list.
> Please provide a reproducible example:
>
https://github.com/hadley/devtools/wiki/Reproducibility
>
> To post: email
ggp...@googlegroups.com
> To unsubscribe: email
ggplot2+u...@googlegroups.com
> More options:
http://groups.google.com/group/ggplot2
>
> ---
> You received this message because you are subscribed to the Google Groups
> "ggplot2" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
ggplot2+u...@googlegroups.com.
> For more options, visit
https://groups.google.com/groups/opt_out.
>
>