find_dims: Find the nearest rectangle that will fit the number of...

View source: R/private_funs.R

find_dimsR Documentation

Find the nearest rectangle that will fit the number of entries in a vector

Description

This function is used by show_colours() to find the dimensions of a grid (as close to square as possible) that will fit all of the entries in a vector of colours.

Usage

find_dims(vec, x = NULL)

Arguments

vec

(Vector) A vector.

x

(Integer) Optionally, the desired width in cells.

Value

A named numeric vector with 2 entries: x and y describing the number of columns and rows respectively.

Examples

## Not run: 
find_dims(1:12)

#> x y
#> 3 4

find_dims(1:12, 2)

#> x y
#> 2 6

## End(Not run)


DesiQuintans/desiderata documentation built on April 9, 2023, 5:43 a.m.