Rilcon42 Rilcon42 - 23 days ago 4
R Question

creating string of numbers seperated by commas

I am trying to create a comma separated string exactly like this to put in a url:

but when I try:
it returns:
[1] "1," "2," "3," "4," "5,"
The spaces are causing issues. How do I get rid of them?

This is not the same question as: this SO post the solution is almost the same, but the question approaches it from a different angle. My question is trying to suppress the spaces, the linked question wants them.


Try to use collapse="," instead of sep=",":

[1] "1,2,3,4,5"