Reputation: 2044
In this tutorial, there is the following code:
library(repurrrsive)
library(listviewer)
library(purrr)
library(tibble)
got_chars %>% {
tibble(
name = map_chr(., "name"),
culture = map_chr(., "culture"),
gender = map_chr(., "gender"),
id = map_int(., "id"),
born = map_chr(., "born"),
alive = map_lgl(., "alive")
)
}
And the explanation provided says: "The dot .
above is the placeholder for the primary input: got_chars in this case. The curly braces {}
surrounding the tibble()
call prevent got_chars from being passed in as the first argument of tibble()
"
I'd like an explanation to what the {}
are doing, and is this a general r property, or one exclusive to purrr
? Is this similar to defining a nameless function such as function(x){ x + 1}
?
Upvotes: 2
Views: 880