Convert gridlayout to matrix format

to_matrix(layout)

Arguments

layout

A gridlayout object (as created by new_gridlayout())

Value

A matrix of the layout with each grid cell and its item membership corresponding to a cell in the matrix

Examples


layout <- md_to_gridlayout("
|10px  |120px   |1fr    |1fr    |
  |100px |header  |header |header |
  |1fr   |sidebar |plot_a |plot_c |
  |1fr   |sidebar |plot_b |plot_b |")

to_matrix(layout)
#>      [,1]      [,2]     [,3]    
#> [1,] "header"  "header" "header"
#> [2,] "sidebar" "plot_a" "plot_c"
#> [3,] "sidebar" "plot_b" "plot_b"