Not sure whether I understand your ultimate goal but it seems to me that you have "names" of traps (A1, B1 etc.) and their positions (x- and y-coordinate). You could simply store that in a data.frame, such as:
a <- data.frame(name = c("A1", "B1", "A2", "B2"), x = c(1, 1, 2, 2), y = c(1, 2, 1, 2))
And then compute the distances using the stats::dist() function, e.g.
dist(a[, c(2,3)])