[R] Need guidance on summarizing time data
Neotropical bat risk assessments and acoustic tools
neotrop|c@|@b@t@ @end|ng |rom gm@||@com
Mon Nov 30 16:48:00 CET 2020
Hi all,
I need to summarize temporal activity. However date\times in R seem to
be not easily handled.
Seems I may need to convert date\time values to a recognizable format?
My "raw data" is tab (text) includes a location ID, date and time(24 hr
format).
Format is like this:
Location Date Time
156 2/25/2008 18:31
156 2/25/2008 18:31
156 2/25/2008 18:32
156 2/25/2008 18:35
156 2/25/2008 18:38
156 2/25/2008 18:41
156 2/25/2008 18:42
156 2/25/2008 18:43
156 2/25/2008 18:43
156 2/25/2008 18:55
156 2/25/2008 18:56
156 2/25/2008 18:56
156 2/26/2008 18:35
156 2/26/2008 18:35
156 2/26/2008 18:35
156 2/26/2008 18:35
196 7/16/2006 4:47
250 4/9/2004 18:41
250 4/9/2004 18:44
253 3/5/2004 18:30
1268 2/11/2001 18:39
1268 2/11/2001 18:39
1344 4/17/2003 19:06
1409 2/28/2004 5:51
...etc. for 10,390 rows of data.
I am aiming for a summary by times for all of the data such that I have
total number of "events" or count for each time period. So something like
18:31 41
18:32 38
and so on.
So a "simple" count of the time occurrences.
I tried to do a summary running frequencies
descriptive.table(vars = d(Time) ,
+ strata = d(Date),data= Active,
+ func.names =c("Valid N","Minimum","Maximum"))
Warning message:
In descriptive.table(vars = d(Time), strata = d(Date), data = Active, :
Non-numeric variables dropped from descriptive table
> Active[,3]<-as.POSIXct(Active[,3], format='%m-%d-%y %H:%M:%S')
> Active[,2]<-as.Date(Active[,2], format= '%m/%d/%y')
> frequencies(Active[c("Time")] , r.digits = 1)
Error in names(x) <- value :
'names' attribute [4] must be the same length as the vector [3]
Suggestions welcomed.
Cheers all
--
Bruce W. Miller, PhD.
Neotropical bat risk and acoustic assessments
Conservation Fellow - Wildlife Conservation Society
Research Associate, American Museum of Natural History
If we lose the bats, we may lose much of the tropical vegetation and the lungs of the planet
Using acoustic sampling to identify and map species distributions
and pioneering acoustic tools for ecology and conservation of bats for >25 years.
Key projects include providing free interactive identification keys and call fact sheets for the vocal signatures of New World Bats
More information about the R-help
mailing list