Closed sorts (or Q-sorts) are accomplished using 2-dimensional grids, usually for ranking items across the (horizontal) x-axis, with the (vertical) y-axis used to stack ties.1

pensieve records such grids as psGrids, simple 2-dimensional matrices, where each cell is either TRUE or FALSE depending on whether the cell is allowed. It can be constructed by providing an arbitrary matrix.

library(pensieve)
m <- matrix(data = c(FALSE, TRUE, TRUE, TRUE, FALSE, TRUE), nrow = 2)
grid <- psGrid(grid = m)
grid

In Q methodology, these grids are often specified in a shorthand way, by giving a vector of column heights (number of allowed ties) from the left to the right. This vector of heights — somewhat akin to a histogram — is sometimes also known as a Q distribution. pensieve offers a convenient method to coerce such vectors into psGrids.

## Vector Notation

grid <- as_psGrid(obj = c(1,2,4,5,4,2,1))
grid

The shorthand vector notation implies that there are never any disallowed cells at the bottom of the grid, or anywhere in the middle of other allowed cells. This makes sense when using rectangular grids with the allowed ties approximating a normal distribution, as is often the case.

There is however no reason to assume that all sorts follow such strictures, and the logical psGrid is a more flexible generalisation.

## Forced and Free

A psGrid implies two pieces of information about a sorting study:

1. It specifies the maximum possible ranks (7 for the above example) and number of ties (5 for the above example) of a sort.
2. In conjunction with the number of available items (such as from psItems), it specifies whether a distribution is forced or free. Under a forced distribution, there will be exactly as many allowed cells (TRUE, 19 in the above example) as there are items, forcing participants to occupy every cell. Under a free distribution, there will be more cells than items, and participants will be flexible in which of the allowed cells they actually use.

Distributions are sometimes only reported for forced distributions, but it should be noted that all closed sorts use a grid. Even under a completely free distribution (with all cells TRUE), there is a maximum number of ranks and ties, if simply implied by the size of the table used.

Most pensieve functions do not require a psGrid, but the design choices it stores can be helpful for validating data and enhance analysis and output methods. Specifying a psGrid is highly recommended.

For optional arguments, see psGrid().

## Hexagonal Tiling

pensieve also offers experimental support for (loosely defined) hexagonally tiled grids, though these have limited support in other parts of the package. For details, see psGrid().

Tiling options for psGrid.
offset = NULL offset = 'even' offset = 'odd'
polygon = 'rectangle' Chessboard (default) Brick wall Brick wall
polygon = 'hexagon' Honeycomb Honeycomb

1. In this sense, strictly speaking, the y-dimension of the grid is often meaningless.