-
I found another way to do this, if you are interested in having
Sequals0for time periods where the fish were not heard at all and considered absent. You can add incomplete()fromtidyrand removefilter(!S < 10)when you createS. When you useleft join()you'll have the variabletwhich will end up with manyNAvalues which can be replaced to0using the followingri_daily[is.na(ri_daily)] <- 0.S <- df %>% group_by(animal_id, glatos_array, station_no, station, deploy_lat, deploy_long, season_year, time_bin, season_length) %>% summarise(S = n()) %>% ungroup %>% # minumum amount of dets needed to determine if fish was resident # filter(!S < 10) %>% complete(animal_id, nesting( glatos_array, station_no, station, deploy_lat, deploy_long, season_year, time_bin, season_length ), fill = list(S = 0) ) arrange(animal_id, time_bin) SEdited by Benjamin Hlina
Please register or sign in to comment