R/as.xyz.R

Defines functions as.xyz

Documented in as.xyz

as.xyz <- function(bathy) {

	if (!is(bathy, "bathy")) stop("Objet is not of class bathy")

	lon <- as.numeric(rownames(bathy))
	lat <- as.numeric(colnames(bathy))

	xyz <- data.frame(expand.grid(lon,lat),as.vector(bathy))
	xyz <- xyz[order(xyz[,2], decreasing=TRUE),]
	names(xyz) <- c("V1","V2","V3")
	rownames(xyz) <- 1:nrow(xyz)

	return(xyz)
}
ericpante/marmap documentation built on July 14, 2024, 10:39 a.m.