Learn R Programming

BoardGames (version 1.0.0)

xy2index: Converts a set of x,y coordinates into a matrix index.

Description

This function converts a set of unit x,y coordinates into a matrix index.

Usage

xy2index(data, x, y)

Arguments

data
Matrix or data frame.
x
x-coordinate
y
y-coordinate

Examples

Run this code
M = matrix(1:20,4,5)
xy2index(data=M, x=3, y=2)

Run the code above in your browser using DataLab