I am trying to build a query for an API and I have a function that is my parameters and values in a list. I am having problems if some of my parameters have multiple values. For example,
paramlist1 <- list(
a = "1",
b = "2",
c = "3",
d = "4"
)
paste(names(paramlist1), "=", paramlist1, collapse = "&", sep="")
works fine. But I have some parameters that can contain multiple values. For example,
paramlist2 <- list(
a = "1",
b = "2",
c = c("3", "4"),
d = c("5", "6")
)
I would like this to return me 2 strings:
a=1&b=2&c=3&d=5 and a=1&b=2&c=4&d=6
Maybe my approach to create this parameter list is not the best. Thanks