jmsigner / amt

37 stars 13 forks source link

Error: `.data` is a corrupt grouped_df, the `"groups"` attribute must be a data frame #14

Closed Sadie-SE closed 4 years ago

Sadie-SE commented 4 years ago

Could you please help with the following error associated with home range area estimations for nested tracks? (https://movebankworkshopraleighnc.netlify.app/2019outputfiles/testvignettemovebank)

kde.week <- trk %>% mutate(year = year(t), month = month(t), week = week(t_)) %>% group_by(id, year, month, week) %>% nest(data=-"id") %>% mutate(kdearea = map(data, ~ hr_kde(., levels=c(0.95)) %>% hr_area)) %>% select(id, year, month, week, kdearea) %>% unnest()

Error: .data is a corrupt grouped_df, the "groups" attribute must be a data frame

jmsigner commented 4 years ago

This due to a change in purrr package, try:

kde.week <- trk %>%
mutate(year = year(t_), month = month(t_), week = week(t_)) %>%
nest(data = -c(id, year, month, week)) %>% 
mutate(kdearea = map(data, ~ hr_kde(., levels=c(0.95)) %>% hr_area)) %>%
select(id, year, month, week, kdearea) %>% unnest(cols = kdearea)
Sadie-SE commented 4 years ago

Great, I appreciate that!