matiasandina / fed3

An R package to read and analyze data from FED3 devices
https://matiasandina.github.io/fed3/
Other
0 stars 0 forks source link

Align Experiments that happened in different dates #6

Open matiasandina opened 1 year ago

matiasandina commented 1 year ago

It's often desirable to align dates. There might be different strategies here to deal with it (i.e., what do we align to? how do we minimize errors with dates? Do we overwrite or create a new column common_time)

See previous strategies in the python package here

matiasandina commented 1 year ago

A preliminary version has been pushed. Please test further. It will create aligned_ versions of the datetime columns using the specified groups.

df %>% 
  group_by(FED) %>% 
  set_alignment(datetime, "time") %>% 
  ggplot(aes(aligned_datetime, Pellet_Count)) + geom_line(aes(color = FED))
df %>% 
  group_by(FED) %>% 
  set_alignment(datetime, "time") %>% 
  ggplot(aes(datetime, Pellet_Count)) + geom_line(aes(color = FED))

image

image

matiasandina commented 1 year ago

Alignment using method time will set the minimum time to 00:00:00. This might be desired but it could also be problematic. Consider other alignments:

We should maybe consider adding a way to manually give the zero independent of the method later used for analysis. When you put mice with the FEDs, they will take time before eating, so relying on the min event is not the best idea to set the zero.