Hello,
I create simple function with two argument:
piv_fun = function(s, var){
s %>% filter(!(`Month from Start Date`==(-1)&SICR!='MPD')) %>%
group_by(`Month from Start Date`, var) %>%
summarise(perc = n()) %>%
pivot_wider(names_from = `Month from Start Date`, values_from = perc) %>%
rename("init" = `-1`) %>%
modify_if( is.numeric, function(x) x / sum(x, na.rm = T))%>%
modify_if( is.numeric, round,digits = 4)
}
this function takes two argument, data.frame and variable, and return some summarized data.frame.
I want two use this function in list of data.frames
. I try to use modify
function, but I don't know how to specify second argument in modify
function.
Is there any solution?