[R] Help needed to format data for boxplot time-series
Thomas Adams
tea3rd at gmail.com
Wed Jun 1 14:33:43 CEST 2016
Petr and David,
Thank you so much! Both approaches do precisely what I need. I knew there
had to be a very simple way to do this, but I am still very much a novice
and struggle with data management at times. Also, thank you for the
suggestion to use dput(yourdata) or dput(yourdata[1:20,]) -- I knew such a
thing existed and search for it, but just could not recall the 'dput'
command name.
Regards,
Tom
On Wed, Jun 1, 2016 at 7:23 AM, PIKAL Petr <petr.pikal at precheza.cz> wrote:
> Hi
>
> It is preferable to use output of
>
> dput(yourdata) or dput(yourdata[1:20,])
>
> so that we can use your data.
>
> From your description maybe
>
> boxplot(split(yourdata$value, yourdata$valid_time))
>
> can give you what you want.
>
> Regards
> Petr
>
> > -----Original Message-----
> > From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Thomas
> > Adams
> > Sent: Wednesday, June 1, 2016 2:07 PM
> > To: r-help at r-project.org
> > Subject: [R] Help needed to format data for boxplot time-series
> >
> > 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]]
> >
> > ______________________________________________
> > R-help at 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.
>
> ________________________________
> Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou
> určeny pouze jeho adresátům.
> Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě
> neprodleně jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie
> vymažte ze svého systému.
> Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email
> jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
> Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi
> či zpožděním přenosu e-mailu.
>
> V případě, že je tento e-mail součástí obchodního jednání:
> - vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření
> smlouvy, a to z jakéhokoliv důvodu i bez uvedení důvodu.
> - a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout;
> Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany
> příjemce s dodatkem či odchylkou.
> - trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve
> výslovným dosažením shody na všech jejích náležitostech.
> - odesílatel tohoto emailu informuje, že není oprávněn uzavírat za
> společnost žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn
> nebo písemně pověřen a takové pověření nebo plná moc byly adresátovi tohoto
> emailu případně osobě, kterou adresát zastupuje, předloženy nebo jejich
> existence je adresátovi či osobě jím zastoupené známá.
>
> This e-mail and any documents attached to it may be confidential and are
> intended only for its intended recipients.
> If you received this e-mail by mistake, please immediately inform its
> sender. Delete the contents of this e-mail with all attachments and its
> copies from your system.
> If you are not the intended recipient of this e-mail, you are not
> authorized to use, disseminate, copy or disclose this e-mail in any manner.
> The sender of this e-mail shall not be liable for any possible damage
> caused by modifications of the e-mail or by delay with transfer of the
> email.
>
> In case that this e-mail forms part of business dealings:
> - the sender reserves the right to end negotiations about entering into a
> contract in any time, for any reason, and without stating any reasoning.
> - if the e-mail contains an offer, the recipient is entitled to
> immediately accept such offer; The sender of this e-mail (offer) excludes
> any acceptance of the offer on the part of the recipient containing any
> amendment or variation.
> - the sender insists on that the respective contract is concluded only
> upon an express mutual agreement on all its aspects.
> - the sender of this e-mail informs that he/she is not authorized to enter
> into any contracts on behalf of the company except for cases in which
> he/she is expressly authorized to do so in writing, and such authorization
> or power of attorney is submitted to the recipient or the person
> represented by the recipient, or the existence of such authorization is
> known to the recipient of the person represented by the recipient.
>
--
Thomas E Adams, III
2330 Jack Warner PKWY, #334
Tuscaloosa, AL 35401
1 (513) 739-9512 (cell)
[[alternative HTML version deleted]]
More information about the R-help
mailing list