Learn R Programming

ProTrackR (version 0.4.4)

deletePattern: Remove a PTPattern table from a PTModule object

Description

This method removes a PTPattern from a PTModule object and updates the patternOrder table accordingly.

Usage

# S4 method for PTModule,numeric
deletePattern(x, index)

Value

Returns a PTModule from which the selected PTPattern is deleted.

Arguments

x

A PTModule from which a PTPattern needs to be removed.

index

A numeric index of the PTPattern table that needs to be removed. The index should be between 1 and patternLength. It's not possible to delete multiple patterns simultaneously with this method. A PTModule should always hold at least 1 pattern table, therefore, the last PTPattern table cannot be deleted.

Author

Pepijn de Vries

Details

This method safely removes a PTPattern from a PTModule object, guarding the validity of the PTModule object. It therefore also updates the patternOrder table, by renumbering the indices listed there. The index of the removed object is replaced with a zero in the patternOrder table.

See Also

Other pattern.operations: MODPlugToPTPattern(), PTPattern-class, PTPattern-method, PTPatternToMODPlug(), appendPattern(), pasteBlock(), patternLength(), patternOrderLength(), patternOrder()

Other module.operations: PTModule-class, appendPattern(), clearSamples(), clearSong(), fix.PTModule(), modToWave(), moduleSize(), patternLength(), patternOrderLength(), patternOrder(), playMod(), playingtable(), rawToPTModule(), read.module(), trackerFlag(), write.module()

Examples

Run this code
data("mod.intro")
print(mod.intro)

## delete pattern #2 from mod.intro:

mod.intro <- deletePattern(mod.intro, 2)
print(mod.intro)

Run the code above in your browser using DataLab