Skip to content

Instantly share code, notes, and snippets.

@alfcrisci
Created December 18, 2019 15:51
Show Gist options
  • Save alfcrisci/57828773f07eeccfa9a74696d185a110 to your computer and use it in GitHub Desktop.
Save alfcrisci/57828773f07eeccfa9a74696d185a110 to your computer and use it in GitHub Desktop.
exportXYZ=function(r,nameout="outfile,txt",sep="\t") {
require(sp)
require(raster)
m=data.frame(sp::coordinates(r),z=raster::getValues(r))
write.table(m, file=nameout,sep=sep , col.names = F, row.names = F)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment