Learn R Programming

OpenRepGrid (version 0.1.14)

ring: bring vector values into ring form

Description

the values of a vector that are outside of a given range are remapped to the values of the range. This function is useful for loops over rows and columns of a matrix if the

Usage

ring(x, upper)

Value

vector

Arguments

x

vector

upper

upper limit of range (lower is one. TODO: maybe extend???)

Examples

Run this code
if (FALSE) {
   ring(1:10, 3)

   m <- matrix(1:12, ncol=4)
   for(i in 1:12)
     print(m[ring(i, 3), map(i, 4)])
}

Run the code above in your browser using DataLab