Defines functions check.LinkID.order

check.LinkID.order <- function(shapefile){
  # Checks the order of the LinkID attribute
  # Returns NULL LinkID doesn't exist, or if the order is correct
  # Returns the new order if there is a problem
  att.table <- shapefile$dbf$dbf
  if (is.null(att.table$LinkID)){
    #If there is no LinkID don't need to worry
    LinkID <- att.table$LinkID
    new.LinkID.order <- order(LinkID)
    compare <- new.LinkID.order == (1:length(LinkID))
    #If any do not match
      #Return the new order
      #If they are in the right order already don't need to do anything

Try the DSsim package in your browser

Any scripts or data that you put into this service are public.

DSsim documentation built on March 26, 2020, 7:39 p.m.