Learn R Programming

potts (version 0.5-11)

packPotts: Transform Potts Model Data

Description

transform Potts model data from integer matrix to raw vector and vice versa.

Usage

packPotts(x, ncolor)
inspectPotts(raw)
unpackPotts(raw)

Value

for packPotts a vector of type "raw". for inspectPotts a list containing components

ncolor, nrow, and ncol. for unpackPotts an integer matrix.

Arguments

x

integer matrix containing Potts model data. Colors are coded from one to ncolor.

ncolor

integer scalar, number of colors.

raw

vector of type "raw".

Examples

Run this code
x <- matrix(sample(4, 2 * 3, replace = TRUE), nrow = 2)
x
foo <- packPotts(x, ncolor = 4)
foo
inspectPotts(foo)
unpackPotts(foo)

Run the code above in your browser using DataLab