Learn R Programming

hyperSpec (version 0.95)

index.grid: index.grid: Calculate a Matrix with Indices for x,y-Data

Description

An index matrix giving for each position of the grid index into x and y is calculated. In addidtion, two matrices similar to the matrices returned by rows () and cols (), but giving the values for the x and y coordinates are calculated.

Usage

index.grid(x, y, z)

Arguments

x
Either a hyperSpec object or a vector giving the x coordniates of the points.
y
A vector giving the y coordniates of the points (if x is not a hyperSpec object).
z
z values for the points

Value

  • A list with
  • gridthe index matrix: indices into x and y (or the rows of the hyperSpec object) for each point.
  • x,yx and y coordinates, respectively, for each of the points.
  • zif z was given as an argument, a matrix with the appropriate z value for each point of the grid.

Examples

Run this code
## select a small 4 x 4 corner of chondro
spc <- chondro[c(1, 2, 32, 33, 34, 35, 66, 67, 68,100, 101, 102)]
index.grid (spc, z = spc[[,,1000]])

index.grid (spc$x, spc$y)

Run the code above in your browser using DataLab