PTBlock {ProTrackR}R Documentation

Select and copy a range of PTCells into a PTBlock

Description

Select and copy a range of PTCells from a PTPattern into a PTBlock. This allows a more flexible approach to select and modify PTCells and paste the modified cells back into a PTPattern.

Usage

## S4 method for signature 'PTPattern,numeric,numeric'
PTBlock(pattern, row, track)

Arguments

pattern

A PTPattern object from which the PTBlock needs to be selected.

row

A numeric index or indices of rows that needs to be copied from the pattern into the PTBlock.

track

A numeric index or indices of tracks that needs to be copied from the pattern into the PTBlock.

Details

Most objects in this ProTrackR package are very strict in the operations that are allowed, in order to guarantee validity and compatibility with the original ProTracker. This makes those objects not very flexible.

This PTBlock is not a formal S4 object, in fact you can hardly call it an object at all. It is just a matrix, where each element holds a list with a single PTCell.

This matrix is very flexible and makes it easier to select and modify the cells. This flexibility comes at a cost as validity is only checked at the level of the PTCells. The PTBlock can be pasted back into a PTPattern with the pasteBlock method. At which point validity will be checked again. If your modifications resulted in violation of ProTracker standards, you should not be able to paste the block into a pattern.

Value

Returns a matrix from the selected rows and tracks from the pattern. Each element in the matrix is a list holding a single PTCell.

Author(s)

Pepijn de Vries

See Also

Other block.operations: pasteBlock()

Examples

data("mod.intro")

## in most ProTrackR methods you can only select a single row or track.
## with a PTBlock your selection is more flexible.

## select rows 4 up to 8 and tracks 2 up to 4, from the first
## pattern table in mod.intro:

block <- PTBlock(PTPattern(mod.intro, 1), 4:8, 2:4)

## 'block' is now a matrix with in each a list with a PTCell.
## These can now easily be accessed and modified:

cell1 <- block[1, 1][[1]]

print(cell1)

[Package ProTrackR version 0.4.3 Index]