Skip to content
Prev 19503 / 29559 Next

Error in SpatialPointsDataFrame(..., match.ID=TRUE)?

As a follow-up, it appears that the requirement in
SpatialPointsDataFrame is not that the rownames not be NULL, but that
it be a character.  The line that appears to be causing the issue is:

if (match.ID && is.character(attr(data, "row.names"))) {


Note that in the above example:

is.character(attr(CRAN_df_reordered, "row.names"))
# is FALSE, but:
is.character(rownames(CRAN_df_reordered))
# is TRUE

It appears that data.frames have numeric row names that are allowed to
be re-ordered just like a character row name, so it seems like this
error could be fixed by modding SpatialPointsDataFrame to be:

if (match.ID && is.character(rownames(data)) {

--j
On Wed, Oct 9, 2013 at 5:28 PM, Jonathan Greenberg <jgrn at illinois.edu> wrote: