ctmm-initiative / ctmmweb

Web app for analyzing animal tracking data, built upon ctmm R package
http://biology.umd.edu/movement.html
GNU General Public License v3.0
32 stars 21 forks source link

fixed bug caused by cut on datetime #13

Closed xhdong-umd closed 7 years ago

xhdong-umd commented 7 years ago

The base R function cut.POSIXt has a bug that cannot cut datetime into a number of intervals if the interval value are in-between input values. I sent email to r-devel and discussed the details in lubridate issue.

Now I just extracted a part of cut.R into a new function and wrote a proper cut for my need.

I found the breaks generated from cut are very useful, but the original cut just give you a certain format of breaks as labels, which make a lot of things awkward those labels are not enough. I have saw people asking how to get the breaks value, and the answer used regular expression to parse the number from labels!

Now with the breaks value I can do a lot of things much easier: