purrr:map with argument

How do I pass an extra two arguments to a purrr:map function

This works ( not real code )

test -> function(.value) {
print value
}
purrr::map(values,test)

but how do I send two extra parameters A and B to the function

test -> function(.value) { ( 2nd and 3rd parameter ??? )
print value
...do something with a A
...do something with a B
}

purrr::map(values,test,??? )

I think I have seen the tilde character used ie ~test

Thanks

purrr::map(values, ~test(.,A,B))

run test for every member of values, when you run test put the member of values as the first parameter (where the . shortcut is, and use A and B as the other parameters)

Thanks..does the function change
ie test -< function(.value, A,B) ?

I dont understand your question... ?

Its ok..I worked out..thanks

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.