I'm using TSP package built by Professor M. Hahsler in R. The function is giving the results but when converted to a data frame, it's shuffling the results. How do I save the results in a dataframe?
data <- data.frame(
"lat" = c(13.11256,13.11293,13.11209,13.11225,13.11281, 13.11229),
"lon" = c(77.52533,77.52480,77.52548,77.52532,77.52485,77.52537),
"id" = 1:6
)
big_data <- round(distancematrix(data))
tsp <- TSP(big_data)
methods <- c("nn")
tours <- methods %>% map(function(methods) { solve_TSP(tsp, methods)})
cl <- as.data.frame(tours)