r4epi

What is the difference between . and .data?

て烟熏妆下的殇ゞ 提交于 2021-02-06 11:11:29
问题 I'm trying to develop a deeper understanding of using the dot (".") with dplyr and using the .data pronoun with dplyr . The code I was writing that motivated this post, looked something like this: cat_table <- tibble( variable = vector("character"), category = vector("numeric"), n = vector("numeric") ) for(i in c("cyl", "vs", "am")) { cat_stats <- mtcars %>% count(.data[[i]]) %>% mutate(variable = names(.)[1]) %>% rename(category = 1) cat_table <- bind_rows(cat_table, cat_stats) } # A tibble:

What is the difference between . and .data?

馋奶兔 提交于 2021-02-06 11:08:35
问题 I'm trying to develop a deeper understanding of using the dot (".") with dplyr and using the .data pronoun with dplyr . The code I was writing that motivated this post, looked something like this: cat_table <- tibble( variable = vector("character"), category = vector("numeric"), n = vector("numeric") ) for(i in c("cyl", "vs", "am")) { cat_stats <- mtcars %>% count(.data[[i]]) %>% mutate(variable = names(.)[1]) %>% rename(category = 1) cat_table <- bind_rows(cat_table, cat_stats) } # A tibble:

What is the difference between . and .data?

有些话、适合烂在心里 提交于 2021-02-06 11:07:24
问题 I'm trying to develop a deeper understanding of using the dot (".") with dplyr and using the .data pronoun with dplyr . The code I was writing that motivated this post, looked something like this: cat_table <- tibble( variable = vector("character"), category = vector("numeric"), n = vector("numeric") ) for(i in c("cyl", "vs", "am")) { cat_stats <- mtcars %>% count(.data[[i]]) %>% mutate(variable = names(.)[1]) %>% rename(category = 1) cat_table <- bind_rows(cat_table, cat_stats) } # A tibble: