animalnexus / feedr

R package for working with data collected from RFID feeder visits
https://animalnexus.github.io/feedr/
2 stars 1 forks source link

Presence in minutes missed very short visits #4

Closed rpmady closed 5 years ago

rpmady commented 5 years ago

Hello, I am a researcher just starting to dig into some of my RFID data. I have tried to use the presence() and the activity() functions, but am running intro problems because "bw" is in minutes, not seconds. This means that visits that are shorter than a minute are lost.

Do you have any suggestions or guidance about that? Thanks in advance for your help! I love the feedr() package.

steffilazerte commented 5 years ago

Hi, glad to hear you're having fun with feedr!

Have you tried using a decimal value for bw? I.e. 10 s = 10/60 = 0.166666667 min

visits(data, bw = 0.167)

That should work, but if not, let me know!

Also, remember that R doesn't display times with differences less than a second, but it does recognize them:

> library(lubridate)
> 
> t1 <- ymd_hms("2019-01-01 00:00:10")
> t2 <- ymd_hms("2019-01-01 00:00:10") + seconds(0.5)
> 
> t1
[1] "2019-01-01 00:00:10 UTC"
> t2
[1] "2019-01-01 00:00:10 UTC"
> 
> t1 == t2
[1] FALSE
> 
> difftime(t1, t2)
Time difference of -0.5 secs
rpmady commented 5 years ago

I did think to try that right after I posted this! Thank you very much.