edzer / sp

Classes and methods for spatial data

Home Page:http://edzer.github.io/sp/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Standardize column names of returned spsample coordinates

samuel-rosa opened this issue · comments

Coordinates returned by spsample can have different names depending on the sampling method used. For instance, random and hexagonal sampling return coordinate pairs named x and y, while for regular and nonaligned sampling coordinate pairs are named x1 and x2. the reason for this is that the last two make use of makegrid0 to generate the samples, a function that contains the following line of code inside a for-loop:

name = paste("x", i, sep = "")

I think that it is important to standardize the outputs of spsample so that others can make a more efficient use of spsample. For instance, this could be done by placing the following line o code at the end of the makegrid0 function definition:

colnames(xy) <- c('x', 'y')

I agree that might be nicer, but I essentially only change things in sp if it fixes bugs.

I understand. Would you be willing to mention this naming convention in the documentation, for example, in the notes?

Please feel free to submit a PR for that.