I need to add a new field of sequential numbers to an attribute table of a shapefile. But, I need to sort the attribute table before adding the new field. I am trying to use R (rgdal) as the shapefile has over a million features. Any help or suggestion on how to sort an attribute table of a shapefile using a specific field name would be greatly appreciated.
Thank you for your time in advance.