Get elements and positions out of a gridlayout object

get_elements(layout)

Arguments

layout

Object of class "gridlayout"

Value

List of all unique elements in the layout and their id, {start,end}_row, and {start,end}_col. Positions are indexed starting at 1

See also

Examples

grid_obj <- md_to_gridlayout(
  layout_table = "
        |      |120px   |1fr    |1fr    |
        |------|--------|-------|-------|
        |100px |header  |header |header |
        |1fr   |sidebar |plot_a |plot_a |
        |1fr   |sidebar |plot_b |plot_c |"
 )

 get_elements(grid_obj)
#> [[1]]
#> [[1]]$id
#> [1] "header"
#> 
#> [[1]]$start_row
#> [1] 1
#> 
#> [[1]]$end_row
#> [1] 1
#> 
#> [[1]]$start_col
#> [1] 1
#> 
#> [[1]]$end_col
#> [1] 3
#> 
#> [[1]]$collapsible
#> [1] FALSE
#> 
#> 
#> [[2]]
#> [[2]]$id
#> [1] "sidebar"
#> 
#> [[2]]$start_row
#> [1] 2
#> 
#> [[2]]$end_row
#> [1] 3
#> 
#> [[2]]$start_col
#> [1] 1
#> 
#> [[2]]$end_col
#> [1] 1
#> 
#> [[2]]$collapsible
#> [1] FALSE
#> 
#> 
#> [[3]]
#> [[3]]$id
#> [1] "plot_a"
#> 
#> [[3]]$start_row
#> [1] 2
#> 
#> [[3]]$end_row
#> [1] 2
#> 
#> [[3]]$start_col
#> [1] 2
#> 
#> [[3]]$end_col
#> [1] 3
#> 
#> [[3]]$collapsible
#> [1] FALSE
#> 
#> 
#> [[4]]
#> [[4]]$id
#> [1] "plot_b"
#> 
#> [[4]]$start_row
#> [1] 3
#> 
#> [[4]]$end_row
#> [1] 3
#> 
#> [[4]]$start_col
#> [1] 2
#> 
#> [[4]]$end_col
#> [1] 2
#> 
#> [[4]]$collapsible
#> [1] FALSE
#> 
#> 
#> [[5]]
#> [[5]]$id
#> [1] "plot_c"
#> 
#> [[5]]$start_row
#> [1] 3
#> 
#> [[5]]$end_row
#> [1] 3
#> 
#> [[5]]$start_col
#> [1] 3
#> 
#> [[5]]$end_col
#> [1] 3
#> 
#> [[5]]$collapsible
#> [1] FALSE
#> 
#>