Мы можем использовать melt
из data.table
library(data.table)
melt(setDT(df1), measure = patterns("(WORK|HOME)_ID", "LAT", "LONG"),
value.name = c("ID", "LAT", "LONG"))[, variable := NULL][]
# WORKER_ID ID LAT LONG
#1: 32435353 23434343 39.54 41.53
#2: 32435353 32435353 39.64 42.43
данные
df1 <- structure(list(WORKER_ID = 32435353L, WORK_ID = 23434343L,
HOME_ID = 32435353L,
LAT_WORK = 39.54, LONG_WORK = 41.53, LAT_HOME = 39.64,
LONG_HOME = 42.43), class = "data.frame", row.names = c(NA,
-1L))