I have tried looking at cheatsheets and looking over other questions asked on here but have been unsuccessful in finding an answer.

I am using **R** and My data.frame looks like this:

![Data](https://i.stack.imgur.com/KXMes.png)

I want to take the second column and make it the vertical categories and make the third column the horizontal categories. The first column would then be matched to the corresponding categories in its row.

Here is an example of how I want to format the table: 

![Table](https://i.stack.imgur.com/syXbp.png)

Is there a way write a code to do this in order to avoid using Excel and Word to create the table?