Well If you can make ggplot based on your data, there should be a way to produce summary. Just as curiosity, the data you showed us are the same as you use for ggplot construction?
Maybe I misunderstood your question but let's assume you have records from each location but only BUZZ time is indicated rounded to minutes. I would use few steps First step - sort data frame according to time and aggregate it to get minutes of BUZZ time during a time period Second step - merge artificial data frame with full time in minutes (either 525600 or 527040 rows if full day should be considered) with your BUZZ data frame. This is partly complicated step if you want to consider only night time and before merging you should remove daytime. Or maybe you are already able to extract one data frame with Buzz activity and one data frame with timespan for each day. Again the result of this merging step should be data frame in which you have one time column for total time in minutes and one column indicating when the buzz was observed. Third step - aggregate resulting data frame to get BUZZ time in each day either by table as suggested or by ?aggregate Based on data from John Here is aggregated data frame dat2.ag<- aggregate(dat2$dtime, list(dat2$Species, dat2$Location, format(dat2$dtime, "%d.%m.%Y %H:%M")), min) And result of table > table(dat2.ag$Group.1, dat2.ag$Group.2) 7716 7717 Buzz 2 2 Ptedav 0 4 Ptemes 0 13 indicating 2 minutes Buzz in location 7716 and 2 minutes in location 7717. Cheers Petr > -----Original Message----- > From: R-help <r-help-boun...@r-project.org> On Behalf Of Neotropical bat > risk assessments > Sent: Thursday, December 26, 2019 12:11 AM > To: Bert Gunter <bgunter.4...@gmail.com> > Cc: R. Help Mailing List <r-help@r-project.org> > Subject: Re: [R] What is best way to calculate % of time? > > Hi Bert, > > Tnx for taking time to reply. > For clarification... the data do EXPLICITLY indicate when each species is > active and when a feeding buzz is recorded. > That is ALL it provides based on acoustic data recorded in the field. Only > when a species is recorded is it identified as active. > How this is accomplished is of no importance to the question I asked. > > Note this is Not "individuals" per se. but species as a group. > > I appreciate you taking time to reply. > Clearly this is not a simple solution to what I assumed to be a simple > question. > Restated as... > *How best to use R to calculate occurrence of event( (A) over time vs all > events (b...n) over the same time period give the data frame work I > have.* > > Cheers, > Bruce > > > > I will not get into your explanation of details that, like John, I > > find opaque. Please DO read Hadley's manifesto, as it appears that you > > need to organize your data more appropriately. > > > > AFAICS, however, strictly speaking your data cannot answer the > > question you have posed. **Strictly speaking** to know the proportion > > of active time bats spend feeding, **for each bat** you would need to > > know when it is active and when it is feeding during that time. You > > could then summarize this for all bats (e.g. take the average or > > median proportion) in a species or whatever. As you cannot identify > > individual bats in your data, you cannot do this -- i.e. you cannot > > answer your question. > > > > So the question then becomes: precisely **how** exactly do you propose > > using the data you have to determine when a *group* of bats are active > > and when they are feeding? How are the groups explicitly identified > > and how are their times active and feeding determined? In short, you > > need to have information that is something like: > > > > Bat.Group date active.time.start active.time.end feeding.time.start > > feeding.time.end > > > > ( for a given date and bat group, there may be many multiple entries; > > perhaps for a given group, date, and active time start and end, > > several feeding time start/stop entries ( I have no idea how bats > > behave)). > > > > Until you can expicitly explain how your data can generate such > > information, I think it will be difficult/impossible to help you. > > > > Cheers, > > Bert > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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.
______________________________________________ R-help@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.