[R] Help needed to format data for boxplot time-series

Thomas Adams tea3rd at gmail.com
Wed Jun 1 14:06:53 CEST 2016


All:

I have used R in combination with GRASS GIS spatial data (using spgrass)
many times in the past to generate a 'time series' of boxplots, to show
variations over time. But I have a new problem, not involving spatial data,
but rather, true time-series data (snippet shown below). So, what I want to
do is to generate a 'time-series' of boxplots based on the column
'valid_time' for the 'values' column data. What I can not figure out is how
to either select or format the data for the series of individual boxplots.
Somehow it seems I need to use reshape; do I group the data within a loop?
This does not seem efficient. The full set of data I have covers a 30 day
period at 6-hourly time steps with 9320 rows

Data

lid|ens_num|basis_time|valid_time|value
MDBV1|ens01|2016-04-19 06:00:00|2016-04-21 00:00:00|1431.4787995285
MDBV1|ens01|2016-04-20 18:00:00|2016-04-21 00:00:00|740.777643846512
MDBV1|ens02|2016-04-20 18:00:00|2016-04-21 00:00:00|740.777778561401
MDBV1|ens03|2016-04-20 18:00:00|2016-04-21 00:00:00|740.777441774178
MDBV1|ens04|2016-04-20 18:00:00|2016-04-21 00:00:00|740.777441774178
MDBV1|ens01|2016-04-19 06:00:00|2016-04-21 06:00:00|1430.25545361671
MDBV1|ens01|2016-04-20 18:00:00|2016-04-21 06:00:00|673.404235368919
MDBV1|ens02|2016-04-20 18:00:00|2016-04-21 06:00:00|673.404370083809
MDBV1|ens03|2016-04-20 18:00:00|2016-04-21 06:00:00|673.404235368919
MDBV1|ens04|2016-04-20 18:00:00|2016-04-21 06:00:00|673.404235368919
MDBV1|ens01|2016-04-19 06:00:00|2016-04-21 12:00:00|1429.0170196373
MDBV1|ens01|2016-04-20 18:00:00|2016-04-21 12:00:00|602.801441559601
MDBV1|ens02|2016-04-20 18:00:00|2016-04-21 12:00:00|602.801239487267
MDBV1|ens03|2016-04-20 18:00:00|2016-04-21 12:00:00|602.801441559601
MDBV1|ens04|2016-04-20 18:00:00|2016-04-21 12:00:00|602.801441559601
MDBV1|ens01|2016-04-19 06:00:00|2016-04-21 18:00:00|1427.75029553108
MDBV1|ens01|2016-04-20 18:00:00|2016-04-21 18:00:00|532.976794630909
MDBV1|ens02|2016-04-20 18:00:00|2016-04-21 18:00:00|532.976727273464
MDBV1|ens03|2016-04-20 18:00:00|2016-04-21 18:00:00|532.97639048624
MDBV1|ens04|2016-04-20 18:00:00|2016-04-21 18:00:00|532.976895667076
MDBV1|ens01|2016-04-19 06:00:00|2016-04-22 00:00:00|1426.44531239624
MDBV1|ens01|2016-04-20 18:00:00|2016-04-22 00:00:00|467.520648461056
MDBV1|ens02|2016-04-20 18:00:00|2016-04-22 00:00:00|467.520513746166
MDBV1|ens03|2016-04-20 18:00:00|2016-04-22 00:00:00|467.520379031277
MDBV1|ens04|2016-04-20 18:00:00|2016-04-22 00:00:00|467.520783175945
MDBV1|ens01|2016-04-19 06:00:00|2016-04-22 06:00:00|1425.14127226563
MDBV1|ens01|2016-04-20 18:00:00|2016-04-22 06:00:00|408.103669752502
MDBV1|ens02|2016-04-20 18:00:00|2016-04-22 06:00:00|408.105117937565
MDBV1|ens03|2016-04-20 18:00:00|2016-04-22 06:00:00|408.102255246162
MDBV1|ens04|2016-04-20 18:00:00|2016-04-22 06:00:00|408.193086760426
MDBV1|ens01|2016-04-19 06:00:00|2016-04-22 12:00:00|1423.73767783165
MDBV1|ens01|2016-04-20 18:00:00|2016-04-22 12:00:00|356.017269114971
MDBV1|ens02|2016-04-20 18:00:00|2016-04-22 12:00:00|356.245105671883
MDBV1|ens03|2016-04-20 18:00:00|2016-04-22 12:00:00|355.568634854126
MDBV1|ens04|2016-04-20 18:00:00|2016-04-22 12:00:00|357.646308916569
MDBV1|ens01|2016-04-19 06:00:00|2016-04-22 18:00:00|1422.30188653908
MDBV1|ens01|2016-04-20 18:00:00|2016-04-22 18:00:00|310.664962696362
MDBV1|ens02|2016-04-20 18:00:00|2016-04-22 18:00:00|310.956081572628
MDBV1|ens03|2016-04-20 18:00:00|2016-04-22 18:00:00|310.891788891602
MDBV1|ens04|2016-04-20 18:00:00|2016-04-22 18:00:00|311.764674018288
MDBV1|ens01|2016-04-19 06:00:00|2016-04-23 00:00:00|1420.79065490837
MDBV1|ens01|2016-04-20 18:00:00|2016-04-23 00:00:00|271.319441647482
MDBV1|ens02|2016-04-20 18:00:00|2016-04-23 00:00:00|271.90585556159
MDBV1|ens03|2016-04-20 18:00:00|2016-04-23 00:00:00|272.571818617964
MDBV1|ens04|2016-04-20 18:00:00|2016-04-23 00:00:00|272.197900602722
MDBV1|ens01|2016-04-19 06:00:00|2016-04-23 06:00:00|1419.24197253838
MDBV1|ens01|2016-04-20 18:00:00|2016-04-23 06:00:00|238.587209240341
MDBV1|ens02|2016-04-20 18:00:00|2016-04-23 06:00:00|238.386618769836
MDBV1|ens03|2016-04-20 18:00:00|2016-04-23 06:00:00|246.312821885538
MDBV1|ens04|2016-04-20 18:00:00|2016-04-23 06:00:00|237.956154179716
MDBV1|ens01|2016-04-19 06:00:00|2016-04-23 12:00:00|1417.63953892746
MDBV1|ens01|2016-04-20 18:00:00|2016-04-23 12:00:00|209.872343232489
MDBV1|ens02|2016-04-20 18:00:00|2016-04-23 12:00:00|209.899606158257
MDBV1|ens03|2016-04-20 18:00:00|2016-04-23 12:00:00|215.785316521025
MDBV1|ens04|2016-04-20 18:00:00|2016-04-23 12:00:00|208.711723941135
MDBV1|ens01|2016-04-19 06:00:00|2016-04-23 18:00:00|1415.99035924988
MDBV1|ens01|2016-04-20 18:00:00|2016-04-23 18:00:00|184.638914114666
MDBV1|ens02|2016-04-20 18:00:00|2016-04-23 18:00:00|184.573223766661
MDBV1|ens03|2016-04-20 18:00:00|2016-04-23 18:00:00|189.508672138071
MDBV1|ens04|2016-04-20 18:00:00|2016-04-23 18:00:00|183.818062614059
MDBV1|ens01|2016-04-19 06:00:00|2016-04-24 00:00:00|1414.29375993118
MDBV1|ens01|2016-04-20 18:00:00|2016-04-24 00:00:00|162.991595356035
MDBV1|ens02|2016-04-20 18:00:00|2016-04-24 00:00:00|162.881398576403
MDBV1|ens03|2016-04-20 18:00:00|2016-04-24 00:00:00|166.706644703865
MDBV1|ens04|2016-04-20 18:00:00|2016-04-24 00:00:00|162.506082894182
MDBV1|ens01|2016-04-19 06:00:00|2016-04-24 06:00:00|1411.73094387283
MDBV1|ens01|2016-04-20 18:00:00|2016-04-24 06:00:00|144.685525805521
MDBV1|ens02|2016-04-20 18:00:00|2016-04-24 06:00:00|144.518832969093
MDBV1|ens03|2016-04-20 18:00:00|2016-04-24 06:00:00|147.765293413067
MDBV1|ens04|2016-04-20 18:00:00|2016-04-24 06:00:00|144.311169966888
MDBV1|ens01|2016-04-19 06:00:00|2016-04-24 12:00:00|1409.87780585251
MDBV1|ens01|2016-04-20 18:00:00|2016-04-24 12:00:00|128.826771134949
MDBV1|ens02|2016-04-20 18:00:00|2016-04-24 12:00:00|128.591449481988
MDBV1|ens03|2016-04-20 18:00:00|2016-04-24 12:00:00|131.575131694579
MDBV1|ens04|2016-04-20 18:00:00|2016-04-24 12:00:00|128.445443800783
MDBV1|ens01|2016-04-19 06:00:00|2016-04-24 18:00:00|1407.97159016571
MDBV1|ens01|2016-04-20 18:00:00|2016-04-24 18:00:00|115.098490343833
MDBV1|ens03|2016-04-20 18:00:00|2016-04-24 18:00:00|117.685470885491
MDBV1|ens04|2016-04-20 18:00:00|2016-04-24 18:00:00|114.647296500087


Thank you,
Tom

	[[alternative HTML version deleted]]



More information about the R-help mailing list