R/coord.R

# given a matrix index k, find the corresponding coordinate in the matrix mat
# 
# Author: benderc
###############################################################################


coord <- function(k,mat) {
	y <- ceiling(k/nrow(mat))
	x <- k%%nrow(mat)
	if(x==0) {
		x <- nrow(mat)
	}
	return(c(x,y))
}

Try the ddepn package in your browser

Any scripts or data that you put into this service are public.

ddepn documentation built on May 2, 2019, 4:42 p.m.