globalgov / messydates

R package for Extended Date/Time Format (EDTF)
https://globalgov.github.io/messydates
Other
15 stars 1 forks source link

Logical comparison for row wise filtering when using `dplyr` not working #82

Closed henriquesposito closed 5 months ago

henriquesposito commented 8 months ago
manyhealth::memberships$HUGGO_MEM %>%
  dplyr::filter(messydates::year(Begin) > "1999" & messydates::year(Begin) < "2010") %>% 
  dplyr::filter(stateID == "USA" | stateID == "CHN") %>%
  as_tidygraph() %>%
  mutate_ties(color = ifelse(to == 47, "China", "USA")) %>%
  autographr(edge_color = "color")
henriquesposito commented 8 months ago

This issues was related to comparing 'mdate' objects and character objects (e.g.as_messydate("2010-09-10") > "2009"). This feature has been added now. The following should work @jaeltan . Thank you.

manyhealth::memberships$HUGGO_MEM %>% dplyr::filter(Begin > "1999" & Begin < "2010", stateID == "USA" | stateID == "CHN") %>% as_tidygraph() %>% mutate_ties(color = ifelse(to == 47, "China", "USA")) %>% autographr(edge_color = "color")