gray
1
library(tidyverse)
tibble(a=1:3) %>% mutate(b = map(a, ~{length(.)}))
#> # A tibble: 3 x 2
#> a b
#> <int> <list>
#> 1 1 <int [1]>
#> 2 2 <int [1]>
#> 3 3 <int [1]>
tibble(a=1:3) %>% mutate(b = map(a, ~{n_distinct(.)}))
# Error in mutate_impl(.data, dots) : variable '.' not found
What is the problem?
mara
2
Try updating your dplyr to the latest GH version, should be fixed!
library(tidyverse)
tibble(a=1:3) %>% mutate(b = map(a, ~{length(.)}))
#> # A tibble: 3 x 2
#> a b
#> <int> <list>
#> 1 1 <int [1]>
#> 2 2 <int [1]>
#> 3 3 <int [1]>
tibble(a=1:3) %>% mutate(b = map(a, ~{n_distinct(.)}))
#> # A tibble: 3 x 2
#> a b
#> <int> <list>
#> 1 1 <int [1]>
#> 2 2 <int [1]>
#> 3 3 <int [1]>
Created on 2018-09-27 by the reprex package (v0.2.1.9000)