0

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 foo values ( 1, 55800, )

Failed to create feature

Is there an automated solution other than manually checking for dups and renaming?

jsta
  • 1,345
  • 1
  • 13
  • 30

1 Answers1

1

I would try with data janitor's function clean_names()

Elio Diaz
  • 3,456
  • 9
  • 22