{"author_name":"potisan","blog_url":"https://potisan-programming-memo.hatenablog.jp/","width":"100%","blog_title":"potisan\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30e1\u30e2","categories":["R","tidyverse","\u307e\u3068\u3081\u672a\u767b\u9332\uff08\u7ba1\u7406\u7528\uff09"],"description":"filter\u306f\u30c7\u30fc\u30bf\u30d5\u30ec\u30fc\u30e0\u306e\u884c\u9078\u629e\u3001keep/discard\u306f\u30d9\u30af\u30c8\u30eb\u306e\u8981\u7d20\u9078\u629e\u3067\u3059\u3002 require(dplyr) require(purrr) 1:5 %>% keep(~. %% 2 == 0) # [2, 4] 1:5 %>% discard(~. %% 2 == 0) # [1, 3, 5] tibble(A=1:5, B=11:15) %>% filter(A %% 2 == 0) ## A tibble: 2 x 2 # A B # <int> <int> #1 2 12 #2 4 14 tibble(A=1:5, B=11:15) %>% filter(A %% 2 != 0\u2026","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fpotisan-programming-memo.hatenablog.jp%2Fentry%2F2022%2F01%2F19%2F232558\" title=\"R&amp;tidyverse filter\u3068keep/discard\u306e\u4f7f\u3044\u5206\u3051 - potisan\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30e1\u30e2\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","title":"R&tidyverse filter\u3068keep/discard\u306e\u4f7f\u3044\u5206\u3051","author_url":"https://blog.hatena.ne.jp/potisan/","url":"https://potisan-programming-memo.hatenablog.jp/entry/2022/01/19/232558","version":"1.0","published":"2022-01-19 23:25:58","height":"190","provider_name":"Hatena Blog","provider_url":"https://hatena.blog","image_url":null,"type":"rich"}