Skip to content
Prev 181804 / 398503 Next

IP-Address

normalizedip <- function(ipstring){
  ipsepstring <- strsplit(ipstring,"\\.")[[1]]
  cat(sapply(ipsepstring,function(x)
       sprintf("%03i",as.numeric(x))),sep=".")
}

normalizedip("1.2.3.55")
yields
 "001.002.003.055"
and therefore should allow you to sort in correct order.
edwin Sendjaja wrote: