Hi everybody, My name is Jackson and come here ask for a help to organize data. I really need help from you. I have several data sets to organize. I have to summarize precipitation data collected in different days and months in only one table. However, those data are disperse in days and times. Those rainy days have a more observations than drought ones. Below you can find a hypothetical example of what I have and I what I need comes in sequence. The following table is what I have for a single year. Notice that number of observations varies from day to day entire year. *Day* *Time* *Prec* Jan 1 7:00 20mm 1 7:20 15mm 1 7:30 5mm 2 6:00 10mm 2 15:00 16mm ... ... ...mm 31 7:00 2mm Feb 1 9:00 6mm 1 9:45 30mm 2 6:45 12mm 2 16:00 20mm 2 22:00 60mm *...* *...* *...mm* 28 11:30 25mm *...* *...* *...* *...mm* Dec 31 *...* *...mm* That way is hard to develop analysis comparing to another year. Thus, I would like summarize all information in a new (reasonable) table. I need a command that says: Sum all January 1st, Sum all January 2nd until December 31st resulting in something as follows. *Month Day->* *1* *2* *3* *4* *...* *31* *Jan* 40mm 16mm 50mm 66mm ...mm 90mm *Feb* 60mm 120mm 25mm 45mm ...mm *...* ...mm ...mm ...mm ...mm ...mm ...mm *Dec* 120mm 30mm 26mm 90mm ...mm 5mm The question is: How to manage it? Does anybody could help me? Thank you very much in advance With the best wishes Jackson M. Rodrigues [[alternative HTML version deleted]]
This is pretty badly mangled (please don't post in html), but ?aggregate is probably what you want. Sarah On Sun, Jun 25, 2017 at 5:27 PM, Jackson Rodrigues <jacksonmrodrigues at gmail.com> wrote:> Hi everybody, > > My name is Jackson and come here ask for a help to organize data. > I really need help from you. I have several data sets to organize. > > I have to summarize precipitation data collected in different days and > months in only one table. > However, those data are disperse in days and times. Those rainy days have a > more observations than drought ones. > > Below you can find a hypothetical example of what I have and I what I need > comes in sequence. > > The following table is what I have for a single year. > Notice that number of observations varies from day to day entire year. > > > > *Day* > > *Time* > > *Prec* > > Jan > > > > 1 > > 7:00 > > 20mm > > 1 > > 7:20 > > 15mm > > 1 > > 7:30 > > 5mm > > 2 > > 6:00 > > 10mm > > 2 > > 15:00 > > 16mm > > ... > > ... > > ...mm > > 31 > > 7:00 > > 2mm > > Feb > > 1 > > 9:00 > > 6mm > > 1 > > 9:45 > > 30mm > > 2 > > 6:45 > > 12mm > > 2 > > 16:00 > > 20mm > > 2 > > 22:00 > > 60mm > > *...* > > *...* > > *...mm* > > 28 > > 11:30 > > 25mm > > *...* > > *...* > > *...* > > *...mm* > > Dec > > 31 > > *...* > > *...mm* > > That way is hard to develop analysis comparing to another year. > Thus, I would like summarize all information in a new (reasonable) table. > > I need a command that says: Sum all January 1st, Sum all January 2nd until > December 31st resulting in something as follows. > > *Month Day->* > > *1* > > *2* > > *3* > > *4* > > *...* > > *31* > > *Jan* > > 40mm > > 16mm > > 50mm > > 66mm > > ...mm > > 90mm > > *Feb* > > 60mm > > 120mm > > 25mm > > 45mm > > ...mm > > > *...* > > ...mm > > ...mm > > ...mm > > ...mm > > ...mm > > ...mm > > *Dec* > > 120mm > > 30mm > > 26mm > > 90mm > > ...mm > > 5mm > > The question is: How to manage it? > > Does anybody could help me? > > Thank you very much in advance > > With the best wishes > > Jackson M. Rodrigues >-- Sarah Goslee http://www.functionaldiversity.org
The tidyverse also has nice functions On Sun, Jun 25, 2017 at 5:48 PM Sarah Goslee <sarah.goslee at gmail.com> wrote:> This is pretty badly mangled (please don't post in html), but > ?aggregate > is probably what you want. > > Sarah > > On Sun, Jun 25, 2017 at 5:27 PM, Jackson Rodrigues > <jacksonmrodrigues at gmail.com> wrote: > > Hi everybody, > > > > My name is Jackson and come here ask for a help to organize data. > > I really need help from you. I have several data sets to organize. > > > > I have to summarize precipitation data collected in different days and > > months in only one table. > > However, those data are disperse in days and times. Those rainy days > have a > > more observations than drought ones. > > > > Below you can find a hypothetical example of what I have and I what I > need > > comes in sequence. > > > > The following table is what I have for a single year. > > Notice that number of observations varies from day to day entire year. > > > > > > > > *Day* > > > > *Time* > > > > *Prec* > > > > Jan > > > > > > > > 1 > > > > 7:00 > > > > 20mm > > > > 1 > > > > 7:20 > > > > 15mm > > > > 1 > > > > 7:30 > > > > 5mm > > > > 2 > > > > 6:00 > > > > 10mm > > > > 2 > > > > 15:00 > > > > 16mm > > > > ... > > > > ... > > > > ...mm > > > > 31 > > > > 7:00 > > > > 2mm > > > > Feb > > > > 1 > > > > 9:00 > > > > 6mm > > > > 1 > > > > 9:45 > > > > 30mm > > > > 2 > > > > 6:45 > > > > 12mm > > > > 2 > > > > 16:00 > > > > 20mm > > > > 2 > > > > 22:00 > > > > 60mm > > > > *...* > > > > *...* > > > > *...mm* > > > > 28 > > > > 11:30 > > > > 25mm > > > > *...* > > > > *...* > > > > *...* > > > > *...mm* > > > > Dec > > > > 31 > > > > *...* > > > > *...mm* > > > > That way is hard to develop analysis comparing to another year. > > Thus, I would like summarize all information in a new (reasonable) table. > > > > I need a command that says: Sum all January 1st, Sum all January 2nd > until > > December 31st resulting in something as follows. > > > > *Month Day->* > > > > *1* > > > > *2* > > > > *3* > > > > *4* > > > > *...* > > > > *31* > > > > *Jan* > > > > 40mm > > > > 16mm > > > > 50mm > > > > 66mm > > > > ...mm > > > > 90mm > > > > *Feb* > > > > 60mm > > > > 120mm > > > > 25mm > > > > 45mm > > > > ...mm > > > > > > *...* > > > > ...mm > > > > ...mm > > > > ...mm > > > > ...mm > > > > ...mm > > > > ...mm > > > > *Dec* > > > > 120mm > > > > 30mm > > > > 26mm > > > > 90mm > > > > ...mm > > > > 5mm > > > > The question is: How to manage it? > > > > Does anybody could help me? > > > > Thank you very much in advance > > > > With the best wishes > > > > Jackson M. Rodrigues > > > > -- > Sarah Goslee > http://www.functionaldiversity.org > > ______________________________________________ > 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. >-- Sent from Gmail Mobile [[alternative HTML version deleted]]