I have a code for the pivot table that looks like this:
| var1 | var2 | var3 | Sum_in_items | Sum_in_money |
|---|---|---|---|---|
| First | First | 1 | 10 | 500 |
| Second | Second | 2 | 12 | 500 |
And it looks like this:
db %>%
group_by(var1, var2, var3) %>%
dplyr::summarise(Sum_in_items = round(sum(items)),
Sum_in_money = sum(money))
However, I also have var4 which has several levels (var1, var2, and var3 are also factors) and I need to add these levels of var4 as columns to the table. It should look like in the photo. I am sorry I cannot create the table here. 
I am super new at pivot tables and my formulations might be strange, please ask questions if you have any. I know how to do such thing in tableau (I just drag var4 into columns but here it is harder).