Dplyr :: pull with a bare or quotation mark as an argument?

Based on reading the documentation dplyr::pull and studying the examples, I get the impression that the argument varshould be "empty column name". For instance:

dplyr::pull(mtcars, cyl)
[1] 6 6 4 6 8 6 8 4 4 6 6 8 8 8 8 8 8 4 4 4 4 8 8 8 8 4 4 4 8 6 8 4

However, I just realized that the name of the quoted column also works:

dplyr::pull(mtcars, "cyl")
[1] 6 6 4 6 8 6 8 4 4 6 6 8 8 8 8 8 8 4 4 4 4 8 8 8 8 4 4 4 8 6 8 4

I'm just curious to know if there are differences between the two styles. In addition, are there any shortcomings in using the second option for using non-interactive use (for example, developing an R package).

In these examples, I am using version 0.7.4 of dplyr.

thank

+4
source share
1 answer

pull select_var, quasiquotation , , , .

a <- "cyl"
select_var(names(mtcars), a)
[1] "cyl"
pull(mtcars,a)
 [1] 6 6 4 6 8 6 8 4 4 6 6 8 8 8 8 8 8 4 4 4 4 8 8 8 8 4 4 4 8 6 8 4
+1

Source: https://habr.com/ru/post/1693533/


All Articles