[R] ggplot cumsum refined question (?)

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Tue Oct 6 16:24:02 CEST 2009


Dear Stephen,

It is much easier to do you data preparation before plotting.

Cummul <- ddply(subset(DF, precipitation!="NA"), "gauge_name",
function(x){
	x$Cummul <- cumsum(x$precipitation)
	x
})
ggplot(Cummul, aes(x = date_time, y = Cummul)) + geom_line() +
facet_wrap(~gauge_name, scales="free_y")

HTH,

Thierry 


------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
Thierry.Onkelinx at inbo.be
www.inbo.be

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey

-----Oorspronkelijk bericht-----
Van: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
Namens stephen sefick
Verzonden: dinsdag 6 oktober 2009 16:07
Aan: r-help at r-project.org
Onderwerp: [R] ggplot cumsum refined question (?)

OK, so maybe last night was a little too much at one throw, so I have
reduced the data to two stations- one that has precipitation and one
that does not.  This is going to be in the context of a larger data
set.  I would like to be able to issue a ggplot command and have cum
sum just act on the facets (factors) to apply this.

library(chron)
library(ggplot2)
DF <- structure(list(date_time = structure(c(14522, 14522.0104166667,
14522.0208333333, 14522.03125, 14522.0416666667, 14522.0520833333,
14522.0625, 14522.0729166667, 14522.0833333333, 14522.09375,
14522.1041666667, 14522.1145833333, 14522.125, 14522.1354166667,
14522.1458333333, 14522.15625, 14522.1666666667, 14522.1770833333,
14522.1875, 14522.1979166667, 14522.2083333333, 14522.21875,
14522.2291666667, 14522.2395833333, 14522.25, 14522.2604166667,
14522.2708333333, 14522.28125, 14522.2916666667, 14522.3020833333,
14522.3125, 14522.3229166667, 14522.3333333333, 14522.34375,
14522.3541666667, 14522.3645833333, 14522.375, 14522.3854166667,
14522.3958333333, 14522.40625, 14522.4166666667, 14522.4270833333,
14522.4375, 14522.4479166667, 14522.4583333333, 14522.46875,
14522.4791666667, 14522.4895833333, 14522.5, 14522.5104166667,
14522.5208333333, 14522.53125, 14522.5416666667, 14522.5520833333,
14522.5625, 14522.5729166667, 14522.5833333333, 14522.59375,
14522.6041666667, 14522.6145833333, 14522.625, 14522.6354166667,
14522.6458333333, 14522.65625, 14522.6666666667, 14522.6770833333,
14522.6875, 14522.6979166667, 14522.7083333333, 14522.71875,
14522.7291666667, 14522.7395833333, 14522.75, 14522.7604166667,
14522.7708333333, 14522.78125, 14522.7916666667, 14522.8020833333,
14522.8125, 14522.8229166667, 14522.8333333333, 14522.84375,
14522.8541666667, 14522.8645833333, 14522.875, 14522.8854166667,
14522.8958333333, 14522.90625, 14522.9166666667, 14522.9270833333,
14522.9375, 14522.9479166667, 14522.9583333333, 14522.96875,
14522.9791666667, 14522.9895833333, 14523, 14523.0104166667,
14523.0208333333, 14523.03125, 14523.0416666667, 14523.0520833333,
14523.0625, 14523.0729166667, 14523.0833333333, 14523.09375,
14523.1041666667, 14523.1145833333, 14523.125, 14523.1354166667,
14523.1458333333, 14523.15625, 14523.1666666667, 14523.1770833333,
14523.1875, 14523.1979166667, 14523.2083333333, 14523.21875,
14523.2291666667, 14523.2395833333, 14523.25, 14523.2604166667,
14523.2708333333, 14523.28125, 14523.2916666667, 14523.3020833333,
14523.3125, 14523.3229166667, 14523.3333333333, 14523.34375,
14523.3541666667, 14523.3645833333, 14523.375, 14523.3854166667,
14523.3958333333, 14523.40625, 14522, 14522.0104166667,
14522.0208333333,
14522.03125, 14522.0416666667, 14522.0520833333, 14522.0625,
14522.0729166667, 14522.0833333333, 14522.09375, 14522.1041666667,
14522.1145833333, 14522.125, 14522.1354166667, 14522.1458333333,
14522.15625, 14522.1666666667, 14522.1770833333, 14522.1875,
14522.1979166667, 14522.2083333333, 14522.21875, 14522.2291666667,
14522.2395833333, 14522.25, 14522.2604166667, 14522.2708333333,
14522.28125, 14522.2916666667, 14522.3020833333, 14522.3125,
14522.3229166667, 14522.3333333333, 14522.34375, 14522.3541666667,
14522.3645833333, 14522.375, 14522.3854166667, 14522.3958333333,
14522.40625, 14522.4166666667, 14522.4270833333, 14522.4375,
14522.4479166667, 14522.4583333333, 14522.46875, 14522.4791666667,
14522.4895833333, 14522.5, 14522.5104166667, 14522.5208333333,
14522.53125, 14522.5416666667, 14522.5520833333, 14522.5625,
14522.5729166667, 14522.5833333333, 14522.59375, 14522.6041666667,
14522.6145833333, 14522.625, 14522.6354166667, 14522.6458333333,
14522.65625, 14522.6666666667, 14522.6770833333, 14522.6875,
14522.6979166667, 14522.7083333333, 14522.71875, 14522.7291666667,
14522.7395833333, 14522.75, 14522.7604166667, 14522.7708333333,
14522.78125, 14522.7916666667, 14522.8020833333, 14522.8125,
14522.8229166667, 14522.8333333333, 14522.84375, 14522.8541666667,
14522.8645833333, 14522.875, 14522.8854166667, 14522.8958333333,
14522.90625, 14522.9166666667, 14522.9270833333, 14522.9375,
14522.9479166667, 14522.9583333333, 14522.96875, 14522.9791666667,
14522.9895833333, 14523, 14523.0104166667, 14523.0208333333,
14523.03125, 14523.0416666667, 14523.0520833333, 14523.0625,
14523.0729166667, 14523.0833333333, 14523.09375, 14523.1041666667,
14523.1145833333, 14523.125, 14523.1354166667, 14523.1458333333,
14523.15625, 14523.1666666667, 14523.1770833333, 14523.1875,
14523.1979166667, 14523.2083333333, 14523.21875, 14523.2291666667,
14523.2395833333, 14523.25, 14523.2604166667, 14523.2708333333,
14523.28125, 14523.2916666667, 14523.3020833333, 14523.3125,
14523.3229166667, 14523.3333333333, 14523.34375), format =
structure(c("m/d/y",
"h:m:s"), .Names = c("dates", "times")), origin = structure(c(1,
1, 1970), .Names = c("month", "day", "year")), class = c("chron",
"dates", "times")), gauge = c(2102908L, 2102908L, 2102908L, 2102908L,
2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L,
2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L,
2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L,
2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L,
2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L,
2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L,
2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L,
2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L,
2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L,
2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L,
2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L,
2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L,
2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L,
2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L,
2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L,
2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L,
2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L,
2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L,
2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 21973269L,
21973269L, 21973269L, 21973269L, 21973269L, 21973269L, 21973269L,
21973269L, 21973269L, 21973269L, 21973269L, 21973269L, 21973269L,
21973269L, 21973269L, 21973269L, 21973269L, 21973269L, 21973269L,
21973269L, 21973269L, 21973269L, 21973269L, 21973269L, 21973269L,
21973269L, 21973269L, 21973269L, 21973269L, 21973269L, 21973269L,
21973269L, 21973269L, 21973269L, 21973269L, 21973269L, 21973269L,
21973269L, 21973269L, 21973269L, 21973269L, 21973269L, 21973269L,
21973269L, 21973269L, 21973269L, 21973269L, 21973269L, 21973269L,
21973269L, 21973269L, 21973269L, 21973269L, 21973269L, 21973269L,
21973269L, 21973269L, 21973269L, 21973269L, 21973269L, 21973269L,
21973269L, 21973269L, 21973269L, 21973269L, 21973269L, 21973269L,
21973269L, 21973269L, 21973269L, 21973269L, 21973269L, 21973269L,
21973269L, 21973269L, 21973269L, 21973269L, 21973269L, 21973269L,
21973269L, 21973269L, 21973269L, 21973269L, 21973269L, 21973269L,
21973269L, 21973269L, 21973269L, 21973269L, 21973269L, 21973269L,
21973269L, 21973269L, 21973269L, 21973269L, 21973269L, 21973269L,
21973269L, 21973269L, 21973269L, 21973269L, 21973269L, 21973269L,
21973269L, 21973269L, 21973269L, 21973269L, 21973269L, 21973269L,
21973269L, 21973269L, 21973269L, 21973269L, 21973269L, 21973269L,
21973269L, 21973269L, 21973269L, 21973269L, 21973269L, 21973269L,
21973269L, 21973269L, 21973269L, 21973269L, 21973269L, 21973269L,
21973269L, 21973269L, 21973269L), agency = structure(c(1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "USGS", class = "factor"),
    date = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L,
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
    2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L,
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
    2L), .Label = c("2009-10-05", "2009-10-06"), class = "factor"),
    time = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L,
    11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L,
    23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L,
    35L, 36L, 37L, 38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L,
    47L, 48L, 49L, 50L, 51L, 52L, 53L, 54L, 55L, 56L, 57L, 58L,
    59L, 60L, 61L, 62L, 63L, 64L, 65L, 66L, 67L, 68L, 69L, 70L,
    71L, 72L, 73L, 74L, 75L, 76L, 77L, 78L, 79L, 80L, 81L, 82L,
    83L, 84L, 85L, 86L, 87L, 88L, 89L, 90L, 91L, 92L, 93L, 94L,
    95L, 96L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L,
    13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L,
    25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 36L,
    37L, 38L, 39L, 40L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L,
    11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L,
    23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L,
    35L, 36L, 37L, 38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L,
    47L, 48L, 49L, 50L, 51L, 52L, 53L, 54L, 55L, 56L, 57L, 58L,
    59L, 60L, 61L, 62L, 63L, 64L, 65L, 66L, 67L, 68L, 69L, 70L,
    71L, 72L, 73L, 74L, 75L, 76L, 77L, 78L, 79L, 80L, 81L, 82L,
    83L, 84L, 85L, 86L, 87L, 88L, 89L, 90L, 91L, 92L, 93L, 94L,
    95L, 96L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L,
    13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L,
    25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L), .Label =
c("00:00",
    "00:15", "00:30", "00:45", "01:00", "01:15", "01:30", "01:45",
    "02:00", "02:15", "02:30", "02:45", "03:00", "03:15", "03:30",
    "03:45", "04:00", "04:15", "04:30", "04:45", "05:00", "05:15",
    "05:30", "05:45", "06:00", "06:15", "06:30", "06:45", "07:00",
    "07:15", "07:30", "07:45", "08:00", "08:15", "08:30", "08:45",
    "09:00", "09:15", "09:30", "09:45", "10:00", "10:15", "10:30",
    "10:45", "11:00", "11:15", "11:30", "11:45", "12:00", "12:15",
    "12:30", "12:45", "13:00", "13:15", "13:30", "13:45", "14:00",
    "14:15", "14:30", "14:45", "15:00", "15:15", "15:30", "15:45",
    "16:00", "16:15", "16:30", "16:45", "17:00", "17:15", "17:30",
    "17:45", "18:00", "18:15", "18:30", "18:45", "19:00", "19:15",
    "19:30", "19:45", "20:00", "20:15", "20:30", "20:45", "21:00",
    "21:15", "21:30", "21:45", "22:00", "22:15", "22:30", "22:45",
    "23:00", "23:15", "23:30", "23:45"), class = "factor"),
gauge_height = c(0.75,
    0.75, 0.75, 0.75, 0.74, 0.74, 0.74, 0.74, 0.75, 0.75, 0.75,
    0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.75,
    0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.76, 0.76,
    0.76, 0.76, 0.76, 0.76, 0.76, 0.76, 0.76, 0.76, 0.76, 0.76,
    0.77, 0.77, 0.77, 0.77, 0.78, 0.78, 0.78, 0.78, 0.79, 0.79,
    0.79, 0.79, 0.8, 0.8, 0.8, 0.8, 0.81, 0.81, 0.81, 0.82, 0.82,
    0.83, 0.83, 0.83, 0.84, 0.84, 0.84, 0.84, 0.85, 0.85, 0.85,
    0.85, 0.86, 0.86, 0.86, 0.86, 0.86, 0.87, 0.87, 0.87, 0.87,
    0.87, 0.87, 0.87, 0.87, 0.87, 0.87, 0.88, 0.88, 0.88, 0.88,
    0.88, 0.88, 0.88, 0.88, 0.88, 0.88, 0.88, 0.89, 0.89, 0.89,
    0.89, 0.89, 0.89, 0.89, 0.89, 0.89, 0.89, 0.89, 0.89, 0.9,
    0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9,
    0.9, 0.91, 0.91, 0.91, 0.91, 0.91, 0.91, 0.91, 0.91, 0.91,
    0.91, 0.91, 6.25, 6.26, 6.26, 6.27, 6.27, 6.27, 6.27, 6.27,
    6.27, 6.27, 6.27, 6.27, 6.27, 6.28, 6.28, 6.28, 6.28, 6.28,
    6.28, 6.29, 6.29, 6.29, 6.3, 6.3, 6.29, 6.3, 6.3, 6.3, 6.31,
    6.3, 6.31, 6.31, 6.3, 6.31, 6.3, 6.31, 6.3, 6.3, 6.31, 6.31,
    6.31, 6.31, 6.31, 6.31, 6.32, 6.32, 6.31, 6.31, 6.32, 6.31,
    6.32, 6.32, 6.32, 6.32, 6.32, 6.32, 6.32, 6.31, 6.32, 6.31,
    6.32, 6.33, 6.32, 6.33, 6.33, 6.33, 6.32, 6.32, 6.32, 6.33,
    6.33, 6.33, 6.33, 6.33, 6.33, 6.33, 6.33, 6.34, 6.33, 6.33,
    6.34, 6.34, 6.34, 6.34, 6.35, 6.34, 6.33, 6.35, 6.35, 6.34,
    6.34, 6.35, 6.34, 6.35, 6.36, 6.35, 6.36, 6.35, 6.36, 6.36,
    6.36, 6.35, 6.36, 6.35, 6.36, 6.36, 6.36, 6.35, 6.36, 6.36,
    6.36, 6.36, 6.36, 6.36, 6.35, 6.36, 6.36, 6.36, 6.37, 6.37,
    6.37, 6.36, 6.36, 6.36, 6.37, 6.36, 6.37, 6.37, 6.37, 6.38
    ), discharge = c(4.6, 4.6, 4.6, 4.6, 4.4, 4.4, 4.4, 4.4,
    4.6, 4.6, 4.6, 4.6, 4.6, 4.6, 4.6, 4.6, 4.6, 4.6, 4.6, 4.6,
    4.6, 4.6, 4.6, 4.6, 4.6, 4.6, 4.6, 4.6, 4.6, 4.9, 4.9, 4.9,
    4.9, 4.9, 4.9, 4.9, 4.9, 4.9, 4.9, 4.9, 4.9, 5.1, 5.1, 5.1,
    5.1, 5.4, 5.4, 5.4, 5.4, 5.6, 5.6, 5.6, 5.6, 5.9, 5.9, 5.9,
    5.9, 6.2, 6.2, 6.2, 6.4, 6.4, 6.7, 6.7, 6.7, 7, 7, 7, 7,
    7.2, 7.2, 7.2, 7.2, 7.5, 7.5, 7.5, 7.5, 7.5, 7.8, 7.8, 7.8,
    7.8, 7.8, 7.8, 7.8, 7.8, 7.8, 7.8, 8.1, 8.1, 8.1, 8.1, 8.1,
    8.1, 8.1, 8.1, 8.1, 8.1, 8.1, 8.4, 8.4, 8.4, 8.4, 8.4, 8.4,
    8.4, 8.4, 8.4, 8.4, 8.4, 8.4, 8.7, 8.7, 8.7, 8.7, 8.7, 8.7,
    8.7, 8.7, 8.7, 8.7, 8.7, 8.7, 8.7, 8.7, 8.9, 8.9, 8.9, 8.9,
    8.9, 8.9, 8.9, 8.9, 8.9, 8.9, 8.9, 4290, 4290, 4290, 4300,
    4300, 4300, 4300, 4300, 4300, 4300, 4300, 4300, 4300, 4310,
    4310, 4310, 4310, 4310, 4310, 4320, 4320, 4320, 4330, 4330,
    4320, 4330, 4330, 4330, 4340, 4330, 4340, 4340, 4330, 4340,
    4330, 4340, 4330, 4330, 4340, 4340, 4340, 4340, 4340, 4340,
    4350, 4350, 4340, 4340, 4350, 4340, 4350, 4350, 4350, 4350,
    4350, 4350, 4350, 4340, 4350, 4340, 4350, 4360, 4350, 4360,
    4360, 4360, 4350, 4350, 4350, 4360, 4360, 4360, 4360, 4360,
    4360, 4360, 4360, 4370, 4360, 4360, 4370, 4370, 4370, 4370,
    4380, 4370, 4360, 4380, 4380, 4370, 4370, 4380, 4370, 4380,
    4390, 4380, 4390, 4380, 4390, 4390, 4390, 4380, 4390, 4380,
    4390, 4390, 4390, 4380, 4390, 4390, 4390, 4390, 4390, 4390,
    4380, 4390, 4390, 4390, 4400, 4400, 4400, 4390, 4390, 4390,
    4400, 4390, 4400, 4400, 4400, 4410), precipitation = c(0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.01,
    0, 0, 0, 0, 0, 0, 0.01, 0, 0, 0.02, 0.02, 0.02, 0.01, 0.01,
    0, 0, 0, 0.02, 0, 0.01, 0, 0, 0.01, 0.01, 0.03, 0, 0, 0.03,
    0.01, 0.01, 0.01, 0, 0.01, 0, 0, 0, 0, 0, 0.01, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0.01, 0, 0.01, 0.01, 0, 0.01, 0, 0.01,
    0, 0.01, 0.01, 0.01, 0.01, 0, 0, 0, 0, 0.01, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0.01, 0, 0.01, 0.01, 0, 0.01, 0, 0,
    0, 0, 0, 0, 0, 0.01, 0.02, 0, 0.01, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0.01, 0, 0, 0, 0, 0, 0, 0.01, 0.01,
    0.01, 0.01, 0.01, 0, 0, 0, 0, 0.01, 0.01, 0, 0, 0, 0, 0,
    0, 0.01, 0.04, 0.04, 0.03, 0, 0.02, 0.01, 0.02, 0, 0, 0.01,
    0.03, 0.01, 0, 0, 0.01, 0, 0.01, 0.02, 0, 0.02, 0.02, 0.01,
    0.01, 0.02, 0, 0.01, 0, 0, 0.01, 0, 0, 0.03, 0.01, 0, 0,
    0, 0, 0, 0.01, 0, 0, 0, 0, 0.01, 0.02, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0), gauge_name = structure(c(1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L,
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
    2L, 2L, 2L, 2L, 2L, 2L), .Label = c("FLAT CREEK NEAR INVERNESS, NC",
    "SAVANNAH RIVER NEAR WAYNESBORO, GA"), class = "factor")), .Names
= c("date_time",
"gauge", "agency", "date", "time", "gauge_height", "discharge",
"precipitation", "gauge_name"), row.names = c(NA, -266L), class =
"data.frame")


qplot(as.POSIXct(date_time), precipitation, data=subset(DF,
precipitation!="NA"), geom="line")+facet_wrap(~gauge_name,
scales="free_y")

#if I issue:

qplot(as.POSIXct(date_time),
cumsum(precipitation), data=subset(DF, precipitation!="NA"),
geom="line")+facet_wrap(~gauge_name, scales="free_y")

#ggplot will plot the total cumulative sum and not the sum based no
the facet(factor) I am trying to plot it by.

#check with

cumsum(DF[,"precipitation"])

thanks for any help,
-- 
Stephen Sefick

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

								-K.
Mullis

______________________________________________
R-help at r-project.org mailing list
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.

Druk dit bericht a.u.b. niet onnodig af.
Please do not print this message unnecessarily.

Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer 
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in  this message 
and any annex are purely those of the writer and may not be regarded as stating 
an official position of INBO, as long as the message is not confirmed by a duly 
signed document.




More information about the R-help mailing list