jbaileyh / geogrid

Turning geospatial polygons into regular or hexagonal grids. For other similar functionality see the tilemaps package https://github.com/kaerosen/tilemaps
Other
393 stars 31 forks source link

Function clean() not found #23

Closed lhehnke closed 6 years ago

lhehnke commented 6 years ago

Hi Joseph,

I'm planning on using geogrid for a new project but I couldn't manage to plot the final results. I'm adapting your sample code and while _calculategrid() and _assignpolygons() both work perfectly fine, clean() results in an error message (Error in clean(resulthex) : could not find function "clean").

Do you have any ideas on how to fix/bypass this? Thanks in advance! :-)

jbaileyh commented 6 years ago

Hi @lhehnke

Glad to hear you're planning on using and thanks for raising the issue!

I believe it should be documented in the second code block of the Example in the README but I admit it may not be clear. The function is just something that I used to re-shape the data for use with ggplot2.

For quick reference here it is again:

clean <- function(shape) {
  shape@data$id = rownames(shape@data)
  shape.points = fortify(shape, region="id")
  shape.df = merge(shape.points, shape@data, by="id")
}

Hope this helps!

lhehnke commented 6 years ago

Thanks for helping, you're absolutely right.

jbaileyh commented 6 years ago

Good luck with the project!