get_table_layout: get_table_layout

View source: R/distribute.R

get_table_layoutR Documentation

get_table_layout

Description

This helper function converts a single-dimensional vector into a two-dimensional tabular matrix.

Usage

get_table_layout(
  n = 1,
  i = 1:n,
  origincorner = "topleft",
  direction = "row",
  cols = NULL,
  rows = NULL
)

Arguments

n

The number of items, if vector is to start from 1 and end at n. Default=1

i

A vector of numbers to be ordered. Default=1:n

direction

The direction by which the table should be filled: row, column. Default="row"

cols

Number of columns to define the matrix

rows

Number of rows to define the matrix

originalcorner

The corner from which the matrix should be filled: topleft, bottomleft, topright, bottomright. Default="bottomleft"

Details

In morphogram, it is used to help structure the tabular distribution layouts. Optional are the origin corner, direction of filling, number columns and/or rows.

Value

A matrix containing the vector.

If only cols is present, rows are calculated automatically to make a matrix. If neither cols or rows are present, cols is set to sqrt of length of vector. The vector is also padded with NA to create empty cells where the cols*rows is greater than the length of the initial vector.


tcwilkinson/morphogram documentation built on Nov. 20, 2022, 3:45 a.m.