{"action":"created","issue":{"url":"https://api.github.com/repos/thomasp85/gganimate/issues/98","repository_url":"https://api.github.com/repos/thomasp85/gganimate","labels_url":"https://api.github.com/repos/thomasp85/gganimate/issues/98/labels{/name}","comments_url":"https://api.github.com/repos/thomasp85/gganimate/issues/98/comments","events_url":"https://api.github.com/repos/thomasp85/gganimate/issues/98/events","html_url":"https://github.com/thomasp85/gganimate/issues/98","id":341758252,"node_id":"MDU6SXNzdWUzNDE3NTgyNTI=","number":98,"title":"lp.assign error with sf and transition_states","user":{"login":"alistaire47","id":1693477,"node_id":"MDQ6VXNlcjE2OTM0Nzc=","avatar_url":"https://avatars3.githubusercontent.com/u/1693477?v=4","gravatar_id":"","url":"https://api.github.com/users/alistaire47","html_url":"https://github.com/alistaire47","followers_url":"https://api.github.com/users/alistaire47/followers","following_url":"https://api.github.com/users/alistaire47/following{/other_user}","gists_url":"https://api.github.com/users/alistaire47/gists{/gist_id}","starred_url":"https://api.github.com/users/alistaire47/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alistaire47/subscriptions","organizations_url":"https://api.github.com/users/alistaire47/orgs","repos_url":"https://api.github.com/users/alistaire47/repos","events_url":"https://api.github.com/users/alistaire47/events{/privacy}","received_events_url":"https://api.github.com/users/alistaire47/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-07-17T04:05:20Z","updated_at":"2018-07-18T03:20:54Z","closed_at":null,"author_association":"NONE","body":"Thanks for your work! The new interface is excellent, and looks like it's only going to improve from here.\r\n\r\nMy issue: I've run into a cryptic error when trying to animate sf maps with `transition_states`:\r\n\r\n``` r\r\nlibrary(sf)\r\n#> Linking to GEOS 3.6.1, GDAL 2.1.3, proj.4 4.9.3\r\nlibrary(tidyverse)\r\nlibrary(gganimate)\r\n\r\nnc = st_read(system.file(\"shape/nc.shp\", package=\"sf\"))\r\n#> Reading layer `nc' from data source `/Library/Frameworks/R.framework/Versions/3.5/Resources/library/sf/shape/nc.shp' using driver `ESRI Shapefile'\r\n#> Simple feature collection with 100 features and 14 fields\r\n#> geometry type:  MULTIPOLYGON\r\n#> dimension:      XY\r\n#> bbox:           xmin: -84.32385 ymin: 33.88199 xmax: -75.45698 ymax: 36.58965\r\n#> epsg (SRID):    4267\r\n#> proj4string:    +proj=longlat +datum=NAD27 +no_defs\r\n\r\n# make inverse ratios for pair of variables\r\nnc_ratio <- nc %>% \r\n  gather(year, bir, BIR74, BIR79) %>% \r\n  group_by(NAME) %>% \r\n  mutate(ratio = bir / rev(bir)) %>% \r\n  ungroup()\r\n\r\n# facet_wrap works fine...\r\nggplot(nc_ratio, aes(fill = ratio)) + geom_sf() + facet_wrap(~year, nrow = 2)\r\n```\r\n![](https://i.imgur.com/9jNpKXz.png)\r\n\r\n``` r\r\n# ...but transition_states errors out\r\nggplot(nc_ratio, aes(fill = ratio)) + geom_sf() + transition_states(year, 1, 3)\r\n#> Error in lp.assign(distance): NA/NaN/Inf in foreign function call (arg 4)\r\n```\r\nI can do the tweening with `tweenr::tween_states` and then use `transition_manual`, and it works fine (though the resulting object needs to be reclassed and wrapping takes some work), so it would seem this should be possible in the new interface.\r\n\r\nI've replicated this on multiple map (multipolygon) datasets, but it does not seem to arise when point data is treated in precisely the same manner:\r\n``` r\r\nmtcars %>% \r\n  mutate(geometry = map2(wt, drat, ~st_point(c(...))) %>% st_sfc()) %>% \r\n  st_sf() %>% gather(i, x, wt, drat) %>% \r\n  ggplot(aes(color = x)) + \r\n  geom_sf() + \r\n  scale_color_distiller(type = 'div', palette = 2) + \r\n  transition_states(i, 1, 1)\r\n```\r\n![](https://i.imgur.com/SfbqlEU.gif)\r\n\r\nI really have no idea what's causing the error; it appears pretty deep-rooted, beyond my debugging skills."},"comment":{"url":"https://api.github.com/repos/thomasp85/gganimate/issues/comments/405796476","html_url":"https://github.com/thomasp85/gganimate/issues/98#issuecomment-405796476","issue_url":"https://api.github.com/repos/thomasp85/gganimate/issues/98","id":405796476,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNTc5NjQ3Ng==","user":{"login":"alistaire47","id":1693477,"node_id":"MDQ6VXNlcjE2OTM0Nzc=","avatar_url":"https://avatars3.githubusercontent.com/u/1693477?v=4","gravatar_id":"","url":"https://api.github.com/users/alistaire47","html_url":"https://github.com/alistaire47","followers_url":"https://api.github.com/users/alistaire47/followers","following_url":"https://api.github.com/users/alistaire47/following{/other_user}","gists_url":"https://api.github.com/users/alistaire47/gists{/gist_id}","starred_url":"https://api.github.com/users/alistaire47/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alistaire47/subscriptions","organizations_url":"https://api.github.com/users/alistaire47/orgs","repos_url":"https://api.github.com/users/alistaire47/repos","events_url":"https://api.github.com/users/alistaire47/events{/privacy}","received_events_url":"https://api.github.com/users/alistaire47/received_events","type":"User","site_admin":false},"created_at":"2018-07-18T03:20:54Z","updated_at":"2018-07-18T03:20:54Z","author_association":"NONE","body":"The reason makes sense. When I tried to install, devools tells me that the SHA hasn't changed since my last install, though, so the error is occurring with the current version."}}
{"actor":{"display_login":"alistaire47"}}