I'm trying to generate a matrix in R with rownames as a value in dataframe and colnames as so too. The values named by the row value and col value should match up with what's in the dataframe.
p photo filter time
1 1 winter.png edge1 94.51301
2 1 rocks.png edge1 65.58044
3 1 pupper.png edge1 47.72965
4 2 winter.png edge1 57.73461
5 2 rocks.png edge1 37.07482
6 2 pupper.png edge1 26.07539
7 3 winter.png edge1 39.93299
8 3 rocks.png edge1 27.81006
9 3 pupper.png edge1 18.99070
10 4 winter.png edge1 33.10323
11 4 rocks.png edge1 22.59480
12 4 pupper.png edge1 15.38318
So for example I would like to produce something like:
1 2 3 4
winter.png 94.51301 37.07482
rocks.png 65.58044 37.07482 27.81006
pupper.png 47.72965 26.07539
(Not completely shown because I'm lazy)
Is there any good way for me to generate matrices as defined.
I want certain fields to placed in the rownames
and colnames
section of a matrix. That thing I can access with those functions.