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)
}

Try the marmap package in your browser

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

marmap documentation built on March 31, 2023, 6:59 p.m.