This method will coerce a set of objects to a PTTrack
object. It can also
be used to select specific tracks from PTModule
and
PTPattern
objects and replace the selected PTTrack
.
Usage
# S4 method for raw,missing,missing
PTTrack(x)
# S4 method for matrix,missing,missing
PTTrack(x)
# S4 method for character,missing,missing
PTTrack(x)
# S4 method for PTModule,numeric,numeric
PTTrack(x, track, pattern)
# S4 method for PTModule,numeric,numeric,PTTrack
PTTrack(x, track, pattern) <- value
# S4 method for PTPattern,numeric,missing
PTTrack(x, track)
# S4 method for PTPattern,numeric,missing,PTTrack
PTTrack(x, track) <- value
Arguments
- x
Object (any of
raw
data, a 64 by 4matrix
ofraw
data, a vector ofcharacter
strings, aPTPattern
or aPTModule
) to coerce to aPTTrack
. See details below for the required format ofx
- track
When
x
is aPTPattern
, or aPTModule
, provide an index [1,4] of the track that needs to be coerced to aPTTrack
.- pattern
When
x
is aPTModule
, provide an index of the pattern that needs to be coerced to aPTTrack
. Note that ProTracker uses indices for patterns that start at zero, whereas R uses indices that start at one. Hence add one to an index obtained from aPTModule
object (e.g.,x$pattern.order
)- value
An object of
PTTrack
with which thePTTrack
object at the specified indices in objectx
needs to be replaced.
Value
When PTTrack
is used, a PTTrack
object
based on x
is returned.
When PTTrack<-
is used, object x
is returned in which
the selected PTTrack
is replaced with value
.
Details
Method to coerce x
to class PTTrack
.
When x
is a 64 by 4 matrix
of raw
data, each row
implicitly represents a PTCell
object and should
be formatted accordingly. See PTCell
documentation for
more details.
When x
is a 64 element vector
of character
representation
of PTCell
objects, the character
representation must be
conform the specifications as documented at the PTCell
.
When x
is of class PTPattern
, or
PTModule
, the PTTrack
at the specified indices
(track
and pattern
) is returned, or can be replaced.
See also
Other track.operations:
as.character()
Examples
## This will create an 'empty' PTTrack with all nul
## values, which is equivalent to new("PTTrack"):
PTTrack(as.raw(0x00))
#> [1] "--- 00 000" "--- 00 000" "--- 00 000" "--- 00 000" "--- 00 000"
#> [6] "--- 00 000" "--- 00 000" "--- 00 000" "--- 00 000" "--- 00 000"
#> [11] "--- 00 000" "--- 00 000" "--- 00 000" "--- 00 000" "--- 00 000"
#> [16] "--- 00 000" "--- 00 000" "--- 00 000" "--- 00 000" "--- 00 000"
#> [21] "--- 00 000" "--- 00 000" "--- 00 000" "--- 00 000" "--- 00 000"
#> [26] "--- 00 000" "--- 00 000" "--- 00 000" "--- 00 000" "--- 00 000"
#> [31] "--- 00 000" "--- 00 000" "--- 00 000" "--- 00 000" "--- 00 000"
#> [36] "--- 00 000" "--- 00 000" "--- 00 000" "--- 00 000" "--- 00 000"
#> [41] "--- 00 000" "--- 00 000" "--- 00 000" "--- 00 000" "--- 00 000"
#> [46] "--- 00 000" "--- 00 000" "--- 00 000" "--- 00 000" "--- 00 000"
#> [51] "--- 00 000" "--- 00 000" "--- 00 000" "--- 00 000" "--- 00 000"
#> [56] "--- 00 000" "--- 00 000" "--- 00 000" "--- 00 000" "--- 00 000"
#> [61] "--- 00 000" "--- 00 000" "--- 00 000" "--- 00 000"
## This will generate a PTTrack from a repeated
## character representation of a PTCell:
chan <- PTTrack(rep("C-3 01 C20", 64))
data("mod.intro")
## This will replace the PTTrack at pattern
## number 1, track number 2 of mod.intro with chan:
PTTrack(mod.intro, 2, 1) <- chan