jmsigner / amt

37 stars 13 forks source link

how to output shape file of kde results? #97

Closed leiallen521 closed 10 months ago

leiallen521 commented 10 months ago

I have multiple animals need to calculate kde, but i don't know how to use writeORG function to output shpe file based on results from hr_kde function. I find a example in stackoverflow here ,but it doesn't work. Can you provide a simple code to realize that ? Thx!!!

jmsigner commented 10 months ago

What is the error that you encounter, here is a simple example:

library(amt)

data(amt_fisher)

amt_fisher |> nest(data = -id) |> 
  mutate(kde = map(data, ~ .x |> hr_kde())) |> hr_to_sf(kde, id) |> 
  st_write(file.path(tempdir(), "hrs.shp"))