Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

pasteBlock

Paste a block of PTCell data into a PTPattern


Description

Paste a block of PTCell data into a PTPattern at a specified location.

Usage

## S4 method for signature 'PTPattern,matrix,numeric,numeric'
pasteBlock(pattern, block, row.start, track.start)

Arguments

pattern

A PTPattern object into which the block needs to be pasted.

block

A PTBlock holding the PTCell data that needs to be pasted into the pattern.

row.start

A positive integer value (ranging from 1 up to 64) indicating the starting position (row) in the pattern to paste the block into.

track.start

A positive integer value (ranging from 1 up to 4) indicating the starting position (track) in the pattern to paste the block into.

Details

A PTBlock is not a formal S4 class. It is a matrix where each element holds a list of a single PTCell object. As explained at the PTBlock method documentation, this allows for a flexible approach of manipulating PTCell objects. The pasteBlock method allows you to paste a PTBlock back into a PTPattern.

The PTBlock will be pasted at the specified location and will span the number of tracks and rows that are included in the PTBlock. The PTCells in the pattern will be replaced by those of the block. Elements of the bock that are out of the range of the pattern are not included in the pattern.

Value

Returns a copy of pattern into which block is pasted.

Author(s)

Pepijn de Vries

See Also

Other block.operations: PTBlock()

Examples

data("mod.intro")

block <- PTBlock(PTPattern(mod.intro, 1), 1:16, 1)

## Do some operations using lapply (the effect
## code is set to "C10"):
block <- matrix(lapply(block, function(x) {(effect(x) <- "C10"); x}),
                nrow(block), ncol(block), byrow = TRUE)

## Paste block back on the same position:
PTPattern(mod.intro, 1) <-
  pasteBlock(PTPattern(mod.intro, 1), block, 1, 1)

## You can also paste the block anywhere you like:
PTPattern(mod.intro, 1) <-
  pasteBlock(PTPattern(mod.intro, 1), block, 49, 2)

ProTrackR

Manipulate and Play 'ProTracker' Modules

v0.3.7
GPL-3
Authors
Pepijn de Vries [aut, cre, dtc]
Initial release
2020-02-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.