An oddly specific task - I have a dataframe with columns with values I need to concatenate in order to prepare a query for a website that requires very specific inputs: unquoted strings, separated by commas. Here's a dput()
of a subset of the dataframe with the columns needed:
d = structure(list(CodeSpace = c(1303L, 1303L, 1303L, 1303L, 1303L,
1303L), TagID = c(23041L, 23042L, 23044L, 23046L, 23043L, 23045L
)), class = "data.frame", row.names = c(NA, -6L))
The output I need is:
A69-1303-23041, A69-1303-23042, A69-1303-23044, A69-1303-23046, A69-1303-23043, A69-1303-23045
I can approximate it (though I end up with a trailing comma) with:
cat(paste0(noquote(paste("A69", d$CodeSpace, d$TagID, sep = "-")) , ","))
Is there a better (i.e. more principled) way to do this?