Created
February 21, 2022 12:18
-
-
Save MJacobs1985/a020ac874ab5408b841ad256fc1433d9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| master_data_tbl <- dfnew %>% | |
| filter(date_interval>"2021-06-10")%>% | |
| dplyr::select(feed_provided, | |
| lcn_id, | |
| newField, | |
| date_interval)%>% | |
| filter(!is.na(date_interval))%>% | |
| distinct()%>% | |
| group_by(lcn_id, newField) %>% | |
| imputeTS::na_kalman(.)%>% | |
| as_tsibble(key = c(lcn_id,newField), | |
| index = date_interval) %>% | |
| group_by_key()%>% | |
| ungroup() | |
| table(is.na(master_data_tbl$feed_provided)) | |
| table(is.na(df$feed_provided)) | |
| table(is.na(master_data_tbl$date_interval)) | |
| table(is.na(master_data_tbl$lcn_id)) | |
| set.seed(1223) | |
| master_data_tbl %>% | |
| distinct(lcn_id, newField)%>% | |
| sample_n(30)%>% | |
| left_join(master_data_tbl) %>% | |
| group_by(date_interval, lcn_id, newField) %>% | |
| summarise(feed_provided = sum(feed_provided, na.rm = T)) %>% | |
| as_tsibble(key = c(lcn_id, newField), index = date_interval) %>% | |
| autoplot(feed_provided) + | |
| scale_color_viridis(discrete = T)+ | |
| theme(legend.position = "none")+ | |
| facet_wrap(~newField, ncol=2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment