# create x and y defining square border
x = seq(min(lon), max(lon), length = 60)
y = seq(min(lat), max(lat), length = 80)
border = border.grid(x, y)
sp::plot(border)
# use lon and lat to define border of an irregular grid
border2 = border.grid(lon, lat)
sp::plot(border2)
Run the code above in your browser using DataLab