Error in replacing data
JuliaNiemeyer opened this issue · comments
This only happens to one of the species I am working with (so far).
Apparently there is nothing wrong with the input data.
This is the code I am using:
geo.clean <- clean_coordinates(x = merge_coord,
lon = "decimalLongitude",
lat = "decimalLatitude",
species = "species",
value = "clean")
And the error:
Flagged 120 records.
Testing geographic outliers
Flagged 121 records.
Error in$<-.data.frame
(*tmp*
, "otl", value = c(TRUE, TRUE, TRUE, :
replacement has 552 rows, data has 542
Don't know how to proceed.
Hi,
hard to tell. Could you provide the example data?
Cheers,
Alex
SO, this problem is the filtering step removing NAs in line 107 of your script. clean_coordiantes uses rownames to match the results from the different tests.
Your filtering step removes rows, but keeps rownames, so that there is a mismatch, which causes this problem. This is not ideal, for now, you can fix this by either using the individual cc_* functions or by resetting the rownames after you filtered out the NAs. To do so add rownames(merge_coord ) <- NULL
after you filtered out the NAs. Hope that helps for now.
No worries, thanks for reporting! The dependencies on the row names should be removed from clean_coordinates. Closing this issue now.