{"action":"created","issue":{"url":"https://api.github.com/repos/weecology/bbs-forecasting/issues/62","repository_url":"https://api.github.com/repos/weecology/bbs-forecasting","labels_url":"https://api.github.com/repos/weecology/bbs-forecasting/issues/62/labels{/name}","comments_url":"https://api.github.com/repos/weecology/bbs-forecasting/issues/62/comments","events_url":"https://api.github.com/repos/weecology/bbs-forecasting/issues/62/events","html_url":"https://github.com/weecology/bbs-forecasting/issues/62","id":170275693,"number":62,"title":"filter_ts() not actually filtering","user":{"login":"sdtaylor","id":12282062,"avatar_url":"https://avatars.githubusercontent.com/u/12282062?v=3","gravatar_id":"","url":"https://api.github.com/users/sdtaylor","html_url":"https://github.com/sdtaylor","followers_url":"https://api.github.com/users/sdtaylor/followers","following_url":"https://api.github.com/users/sdtaylor/following{/other_user}","gists_url":"https://api.github.com/users/sdtaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/sdtaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdtaylor/subscriptions","organizations_url":"https://api.github.com/users/sdtaylor/orgs","repos_url":"https://api.github.com/users/sdtaylor/repos","events_url":"https://api.github.com/users/sdtaylor/events{/privacy}","received_events_url":"https://api.github.com/users/sdtaylor/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-08-09T21:29:52Z","updated_at":"2016-08-09T21:36:11Z","closed_at":null,"body":"If I call `get_richness_ts_env_data(start_yr, end_yr, min_num_yrs) %>% na.omit()`, there are sites within it that have less than `min_num_yrs'.  Looks like it has to do with the ordering of things.\r\n\r\nThis is from `forecast-bbs-core.R` line 186. `complete(site_id, year)` fills in all possible years for *all* sites, then `filter_ts()` a few lines down thinks that *all* sites then have plenty of years in their timeseries.  If I take out `complete(site_id, year)` it seems to work but I'm not sure what that might be breaking elsewhere. \r\n\r\n```\r\nget_richness_ts_env_data <- function(start_yr, end_yr, min_num_yrs){\r\n  bbs_data <- get_bbs_data(start_yr, end_yr, min_num_yrs)\r\n  richness_data <- bbs_data %>%\r\n    group_by(site_id, year, lat, long) %>%\r\n    dplyr::summarise(richness = n_distinct(species_id)) %>%\r\n    ungroup() %>%\r\n    complete(site_id, year)\r\n  richness_ts_env_data <- richness_data %>%\r\n    add_env_data() %>%\r\n    filter_ts(start_yr, end_yr, min_num_yrs)\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/weecology/bbs-forecasting/issues/comments/238699521","html_url":"https://github.com/weecology/bbs-forecasting/issues/62#issuecomment-238699521","issue_url":"https://api.github.com/repos/weecology/bbs-forecasting/issues/62","id":238699521,"user":{"login":"sdtaylor","id":12282062,"avatar_url":"https://avatars.githubusercontent.com/u/12282062?v=3","gravatar_id":"","url":"https://api.github.com/users/sdtaylor","html_url":"https://github.com/sdtaylor","followers_url":"https://api.github.com/users/sdtaylor/followers","following_url":"https://api.github.com/users/sdtaylor/following{/other_user}","gists_url":"https://api.github.com/users/sdtaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/sdtaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdtaylor/subscriptions","organizations_url":"https://api.github.com/users/sdtaylor/orgs","repos_url":"https://api.github.com/users/sdtaylor/repos","events_url":"https://api.github.com/users/sdtaylor/events{/privacy}","received_events_url":"https://api.github.com/users/sdtaylor/received_events","type":"User","site_admin":false},"created_at":"2016-08-09T21:36:11Z","updated_at":"2016-08-09T21:36:11Z","body":"Only thing I can think for having the `complete()` is itensures environmental data gets added for all sites and years. But then that row gets carried around with an NA richness value and likely dropped anyway. What do you think @ethanwhite ?"}}
{"actor":{"display_login":"sdtaylor"}}