positiveIndex-class {externalVector} | R Documentation |

## Class "positiveIndex", index class representing a sequence of
non-negative integers

### Description

This represents a subscript of arbitrary non-negative
integers.

### Objects from the Class

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.

### Slots

`.Data`

:- Object of class
`"integer"`

, the actual
index values.
`rangeIndex`

:- Object of class
`"integer"`

of length
`2`

, same as `range(.Data)`

.
`noNA`

:- Object of class
`"logical"`

of length 1,
same as `!any(is.na(.Data))`

.

### Extends

Class `"integer"`

, directly.
Class `"vectorIndex"`

, directly.

### Methods

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`

- Add
`scalar`

to `x`

.
Result is `x`

with `x@.Data`

replaced by
`x@.Data+scalar`

.
`scalar+x`

- Add
`scalar`

to `x`

.
Result is `x`

with `x@.Data`

replaced by
`x@.Data+scalar`

.
`x*scalar`

- Multiply
`x`

by `scalar`

.
Result is `x`

with `x@.Data`

replaced by
`x@.Data*scalar`

.
`scalar*x`

- Multiply
`x`

by `scalar`

.
Result is `x`

with `x@.Data`

replaced by
`x@.Data*scalar`

.
- dim(x) <- value
- Set a dimension on
`x`

. If value is of
length 2, this may create a "matrixIndex".
`x[i]`

- Subset x. If length of
`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[]`

- Subset x with the subscript missing. Result is x.
`allNA(x)`

- Are all elements of
`x`

`NA`

? Result is
`all(is.na(x@.Data))`

.
`anyNA(x)`

- Is any element of
`x`

`NA`

? Result is
`any(is.na(x@.Data))`

.
`as.integer(x)`

- Convert
`x`

to an R subscript -
adds 1 to each element of `x@.Data`

.
`initialize(.Object, .Data)`

- Initialize
`.Object`

.

[Package

*externalVector* version 1.0.14

Index]