3

I want to print a character vector in R in a way that I can copy and paste it onto a text. Comma-separated, and no quotes.

There are a few similar questions around.

Dput prints in a code-ready format (Print r vector to copy paste into other code.) but keeps the quotes.

The function noquote removes the quotes, but also removes the commas (Remove quotes from a character vector in R)

> vec <- c('a', 'b', 'c')
> print(vec)
[1] "a" "b" "c"
> dput(vec)
c("a", "b", "c")
> noquote(vec)
[1] a b c

I want to have an output like

a, b, c

or similar.

Anyone has any idea?

Tiago Lubiana
  • 319
  • 1
  • 11

0 Answers0