Skip to content
Prev 323112 / 398502 Next

How does one set up logical functions?

On Tue, May 7, 2013 at 10:02 AM, Neotropical bat risk assessments
<neotropical.bats at gmail.com> wrote:
Here it is using gglot2:


library(ggplot2)
library(gridExtra)

DF2 <- transform(DF,
datetime = as.POSIXct(DF2[[1]], format = "%m/%d/%y %H:%M"),
lower = ifelse(BG < 100, BG - 15, BG * 0.85),
upper = ifelse(BG < 100, BG + 15, BG * 1.15))


ggplot(DF2, aes(datetime, BG)) +
   geom_point() +
   geom_line() +
   geom_smooth(aes(ymin = lower, ymax = upper), stat = "identity") +
   geom_linerange(aes(ymin = lower, ymax = upper)) +
   annotation_custom(tableGrob(DF2, gp = gpar(cex = 0.5)), ymin = 120) +
   coord_cartesian(ylim = c(60, 150)) +
   xlab("") +
   ylab("Blood Glucose") +
   ggtitle("Blood Glucose Levels")


--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com