Home > database >  Why R is Producing Weird and Not Total Row Number
Why R is Producing Weird and Not Total Row Number

Time:02-13

I have a data frame produced from dput. Ideally, when running this dput, the test data frame should have 12 rows with row number 1:12. However, when running this, row 9 to 12 will be produced as row 5.1, 6.1, 7.1 and 8.1. I am sure that the contents of each row are different. I have sf geometry object for each row in this data frame. I am wondering what is the potential reason for causing this issue?

Thanks in advance!

example code (it's very long and exceed the limit of StackOverflow, I will put it into Google drive link):

enter image description here

CodePudding user response:

Isn't it because row names are explicitly named in your data frame?

      .Names = character(0)
    ),
    row.names = c("1", "2", "3", "4", "5", "6", "7", "8", "5.1", "6.1", "7.1", "8.1"),
    class = c("sf", "data.frame")
  ),
  • Related