matrix_long.Rd
A convenience function which melts the matrix and then joins row and column information.
matrix_long( matrix, row_info = NULL, col_info = NULL, varnames = c("name", "col") )
matrix | A matrix, or object that can be converted to a matrix. |
---|---|
row_info | Information about rows of the matrix. A data frame, or object that can be converted to a data frame. |
col_info | Information about columns of the matrix. A data frame, or object that can be converted to a data frame. |
varnames | Vector of two column names in the output, the first for the row and the second for the column. |
A data frame containing the matrix and associated information in long format.
#> name col value true_score #> 1 1 1 -0.77806946 1 #> 2 2 1 -0.51990094 1 #> 3 3 1 -0.08650305 1 #> 4 4 1 -0.87599630 1 #> 5 5 1 -1.36953094 1 #> 6 6 1 -0.04262609 1 #> 7 7 1 1.12974762 1 #> 8 1 2 -2.63735299 2 #> 9 2 2 0.19370989 2 #> 10 3 2 1.82975049 2 #> 11 4 2 0.19639307 2 #> 12 5 2 -3.03830597 2 #> 13 6 2 0.19495389 2 #> 14 7 2 2.75844331 2 #> 15 1 3 -2.95946238 3 #> 16 2 3 -0.90300124 3 #> 17 3 3 2.06168449 3 #> 18 4 3 -0.66129862 3 #> 19 5 3 -2.45523123 3 #> 20 6 3 0.31675055 3 #> 21 7 3 2.56912047 3 #> 22 1 4 NA 4 #> 23 2 4 0.41362710 4 #> 24 3 4 3.49862168 4 #> 25 4 4 -0.28202556 4 #> 26 5 4 -4.57358794 4 #> 27 6 4 -1.09750945 4 #> 28 7 4 4.53500543 4 #> 29 1 5 -4.42682222 5 #> 30 2 5 0.81602282 5 #> 31 3 5 6.26938716 5 #> 32 4 5 1.14469935 5 #> 33 5 5 -5.11392390 5 #> 34 6 5 0.20692910 5 #> 35 7 5 NA 5