Input Format
structure(list(FROM_STOP_ID = c("DEP10001", "DEP10001", "DEP10001",
"DEP10001", "DEP10001", "DEP10001",
"DEP10001", "DEP10001", "DEP10001",
"DEP10001"),
TO_STOP_ID = c("DEP10001", "DEP10022",
"DEP25005", "DEP35024", "DEP45024", "DEP50002",
"STP62369", "STP62829", "STP63844", "STP63889"),
TRAVEL_TIME = c(0, 518, 497, 131, 0, 131, 483, 137,
489, 504)), .Names = c("FROM_STOP_ID", "TO_STOP_ID", "TRAVEL_TIME"
Expected outpout format
First column from input datframe as rownames , second column as column names, third column as values filled up
structure(list(DEP10001 = 0, DEP10022 = 518, DEP25005 = 497,
DEP35024 = 131, DEP45024 = 0), .Names = c("DEP10001", "DEP10022",
"DEP25005", "DEP35024", "DEP45024"), row.names = "DEP10001", class = "data.frame")