[R] how to add comma to string vector?

Rasmus Liland jr@| @end|ng |rom po@teo@no
Fri Jun 10 12:31:56 CEST 2022


Hello ...  

raws <- c("field_1", "field_2",  "field_3")
paste0("['", paste0(raws, collapse="', '"), "']")

rasmus using eightforty ~ % python
Python 3.10.5 (main, Jun  6 2022, 18:49:26) [GCC 12.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> ['field_1', 'field_2', 'field_3']
['field_1', 'field_2', 'field_3']

?

R



More information about the R-help mailing list