I have a few columns
Location|Yes M & M Peanuts| No M& M Peanuts | Yes M & M Almond| No M& M Almond|Location
5 10 20 6 NYC
I would like to do using the table function or something more convenient where i turn those columns into
Yes | No
M & M Peanuts 5 10
M & M Almond 20 6
updated example
df2 <- structure(list(`Yes M & M Peanuts` = 5L, `No M & M Peanuts` = 10L,
`Yes M & M Almond` = 20L, `No M & M Almond` = 6L, "Location" = "NYC"), class = "data.frame",
row.names = c(NA,
-1L))