0

I have been playing with this for a while and am not sure where my misunderstanding is. I am trying to summarize the sampling effort for multiple animals over two years in terms of their telemetry locations. Specifically I am trying to see how many locations per day there is for each animal so I can ensure I have the highest sampling rate possible included when I do further analyses. Using the amt package and summarize_sampling_rate_many() I am not getting useable info. I am using made up data so I know I have a min of 4 locations per day with some days including 5 over 2 years.

unique(d$FieldID)
[1] "HS345" "HS871"
length(unique(d$Date))
[1] 729
d1<-tibble(x=d$Longitude,y=d$Latitude,t=lubridate::ymd(d$Date),id=d$FieldID)
str(d1)
tbl_df [6,560 x 4] (S3: tbl_df/tbl/data.frame)
 $ x : num [1:6560] -123 -123 -123 -123 -123 ...
 $ y : num [1:6560] 59.3 59.3 59.3 59.3 59.3 ...
 $ t : Date[1:6560], format: "2021-01-01" "2021-01-02" ...
 $ id: chr [1:6560] "HS345" "HS345" "HS345" "HS345" ...
##make a track 
tf1<-make_track(d1,x,y,t,id=id)
tf1
# A tibble: 6,560 x 4
      x_    y_ t_         id   
 * <dbl> <dbl> <date>     <chr>
 1 -123.  59.3 2021-01-01 HS345
 2 -123.  59.3 2021-01-01 HS345
 3 -122.  59.3 2021-01-01 HS345
 4 -123.  59.3 2021-01-01 HS345
 5 -123.  59.5 2021-01-01 HS871
 6 -123.  59.4 2021-01-01 HS871
 7 -123.  59.6 2021-01-01 HS871
 8 -123.  59.4 2021-01-01 HS871
 9 -123.  59.3 2021-01-02 HS345
10 -123.  59.3 2021-01-02 HS345

samprate<-tf1 %>% 
  summarize_sampling_rate_many("id","t",time_unit="day")
samprate
id      min    q1 median       mean    q3       max         sd     n unit 
* <chr> <dbl> <dbl>  <dbl>      <dbl> <dbl>     <dbl>      <dbl> <int> <chr>
1 HS345     0     0      0 0.00000257     0 0.0000116 0.00000481  3279 day  
2 HS871     0     0      0 0.00000257     0 0.0000116 0.00000481  3279 day  

Now I get the output is telling me I have 3279 observations total for each animal and the minimum time between observations is 0 (I have at least 1 observation each day) but how do I figure out how many total observations I have PER day/ is that possible using this package.

I know you can do this using the following"

summ<-d %>% 
  group_by(FieldID,Date) %>% 
  summarise(Count=n())

But in my actual dataset I have 20+ years of data and many animals so I feel like there has to be a simpler way to figure this out and I am just missing it.

Thanks in advance!

  • Please make a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) or [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) with a sample input (not posted in an image) and your expected output. This is needed to create, test and verify possible solutions. – Martin Gal Apr 04 '22 at 22:18

0 Answers0