If the data are large, as in Sort large amout of data and save repeated pairs of values in R, using apply()
on each row will be expensive. Instead, create the set of unique values
uid = unique(unlist(testdata[c("Var1", "Var2")], use.names=FALSE))
determine whether a swap is necessary
swap = match(testdata[["Var1"]], uid) > match(testdata[["Var2"]], uid)
and update
tmp = testdata[swap, "Var1"]
testdata[swap, "Var1"] = testdata[swap, "Var2"]
testdata[swap, "Var2"] = tmp
remove duplicates as before
testdata[!duplicated(testdata[1:2]),]
If there were many additional columns, and copying these were expensive, a more self-contained solution would be
uid = unique(unlist(testdata[c("Var1", "Var2")], use.names=FALSE))
swap = match(testdata[["Var1"]], uid) > match(testdata[["Var2"]], uid)
idx = !duplicated(data.frame(
V1 = ifelse(swap, testdata[["Var2"]], testdata[["Var1"]]),
V2 = ifelse(swap, testdata[["Var1"]], testdata[["Var2"]])))
testdata[idx, , drop=FALSE]