R, Excel, Function, Pivot Tables.
excel.func=function(x,y,z){ diamonds %>% group_by({{x}},{{y}}) %>% summarize(mean.value=mean({{z}})) %>% spread({{x}},mean.value) } Note that to refer to the function argument, you shall use {{x}}. I may explain this in another article later. Now we apply the function excel.func to create three