positiveIndex-class {externalVector} | R Documentation |
This represents a subscript of arbitrary non-negative integers.
Objects can be created by calls of the form new("positiveIndex",
val)
. If val
is missing, the result is an object of class
"positiveIndex"
of length 0
. Otherwise, it is coerced
to an integer and an object of class "positiveIndex"
is
created which has the same .Data
slot as val
. The
rangeIndex
and noNA
slots are calculated by the
initialization code.
.Data
:"integer"
, the actual
index values. rangeIndex
:"integer"
of length
2
, same as range(.Data)
. noNA
:"logical"
of length 1,
same as !any(is.na(.Data))
.
Class "integer"
, directly.
Class "vectorIndex"
, directly.
Signature components for the methods are:
x | The class "allIndex" |
scalar | Length one positive "integer" |
i | The class "ANY" |
value | The class "ANY" |
.Object | The class "allIndex" |
x+scalar
scalar
to x
.
Result is x
with x@.Data
replaced by
x@.Data+scalar
. scalar+x
scalar
to x
.
Result is x
with x@.Data
replaced by
x@.Data+scalar
. x*scalar
x
by scalar
.
Result is x
with x@.Data
replaced by
x@.Data*scalar
. scalar*x
x
by scalar
.
Result is x
with x@.Data
replaced by
x@.Data*scalar
. x
. If value is of
length 2, this may create a "matrixIndex". x[i]
i
is 0
, the result
is an object of class "noneIndex"
. Otherwise, the result is
an object of class "sliceIndex"
or of class
"positiveIndex"
. x[]
allNA(x)
x
NA
? Result is
all(is.na(x@.Data))
. anyNA(x)
x
NA
? Result is
any(is.na(x@.Data))
. as.integer(x)
x
to an R subscript -
adds 1 to each element of x@.Data
. initialize(.Object, .Data)
.Object
.