My line of code with the aggregate function found the average(mean) for each value in group 1 and group 2. I want to rearrange this table so that the group 2 values (1 and 2) are the column headings and group 1 values (0-4) are the row headings and then the x values is the data in the middle of the table.
I have tried using the tapply function but I did not get anywhere with that.