I am dealing with a very similar situation as described at:
rgdal::writeOGR collision in column names results in NULL data
I have an sf object with duplicate field names (in a case-insensitive way). Coercing to sp with as(foo, "Spatial") does not do any sanitizing and this breaks downstream processing.
The errors I get are variously:
ERROR: Cannot insert new row: insert into
foovalues ( 1, 55800, )Failed to create feature
Is there an automated solution other than manually checking for dups and renaming?