animalnexus / feedr

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

Possible to get sample size? #5

Closed rpmady closed 2 months ago

rpmady commented 5 years ago

Hello,

I'm interested in seeing how many visits get smushed into 1 visit based on the bw criteria. Is there a way to do that? I've tried modifying the code and subsequent functions myself, but haven't figured it out.

steffilazerte commented 5 years ago

Hmm, that's a good point. There are several ways to do that but nothing immediately straight forward. It would be simple enough to add, however.

I'm away for the next couple of days, but will look into adding that when I get back. Thanks for the suggestion!

rpmady commented 5 years ago

There are? That is great to hear! Anything that you can point me to try and figure out in the meantime? (on a bit of a time crunch)

Thanks for responding even though you are away! I really appreciate it :)

steffilazerte commented 5 years ago

Sorry I didn't have a chance to leave you any hints last week. But on the upside, I have added the functionality and all I need is for you to give it a test run.

There is now an argument count_raw for the visits() function which adds a column raw_n which has the number of raw RFID reads included in each visit.

To install the experimental/development version of feedr, use either the remote or devtools packages:

library(remotes)
install_github("animalnexus/feedr", ref = "experimental")

v <- visits(finches)                    # Normal run
v <- visits(finches, count_raw = TRUE)  # New argument

This is Experimental!

I recommend counting by hand some visits (pick some random ones at the start, middle and end of your data), and comparing the number you count by hand to the number returned by visits().

Let me know if you find any problems!

rpmady commented 5 years ago

No worries, that's alright! Thank you so much for adding this functionality!

I am excited to try this out on my RFID data that I have collected. But I have also been using the raw code of the visits function for another data set that isn't quite in the RFID format, so I've been making adjustments here and there. Do you have the code behind the functionality somewhere too?

steffilazerte commented 5 years ago

It might be easier to transform your data into RFID format rather than tweaking the code, but you can see the changes I've made in this commit. Note that I had to make the changes to the assignment of times and timezones to ensure that the new functionality worked as expected.

rpmady commented 5 years ago

Thanks for this, @steffilazerte!