This might seem like a silly question, but for the life of me I cannot figure it out so appreciate any help.
I am trying to pass .x (from purrr::map) to a function so in the end I get a list of functions (I will use this eventually to pass a list of column definitions with functions inside to reactable). This is a very basic example of what I want to do:
a = list("b", "c")
t <- map(a, ~{
function(.x){
print(x)
}
})
The result I am looking for is:
> t
[[1]]
function(b){
print(x)
}
[[2]]
function(c){
print(x)
}
but I get:
> t
[[1]]
function(.x){
print(x)
}
[[2]]
function(.x){
print(x)
}
Is what I am looking for possible?