eclrs.3 %>%
mutate(start.week = floor_date(realCollectionDate, unit = "week")) %>%
group_by(start.week, k12) %>%
summarise(n = n(), pctpos = 100 * mean(realResult))  %>%
xyplot(pctpos ~ start.week | k12, col = "red", data = ., layout = c(1,2),
ylab = "percent of test results positive", xlab = "specimen collection
date",  strip = strip.custom(strip.names = c(TRUE, TRUE)),  sub = "The
final week shown may not yet be complete so is likely inaccurate",   panel
= function(...){
    panel.xyplot(..., type = "p", cex = 0.8)
    panel.smoother(..., span = 0.3, col.se = "red", alpha.se = 0.08, lwd =
2)})

The above takes patient-level data, each record containing a date, and
aggregates them by week according to that date, then plots 2 weekly time
series, one for k12 and one for not-k12, each with a smoother. Note my
disclaimer in the subtitle that "the final week shown may not yet be
complete . . . ." since I might run this on any arbitrary day. How might I
change the appearance of the smoother lines to emphasize to the viewer that
the recent trends are tentative due to daily data still coming in?  For
example, how might I make the far right-end stretch of the lines,
representing the most recent week or two, dotted?

Thanks.

--Chris Ryan

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to