[R] converting a numeric vector to a single string

Rajarshi Guha rxg218 at psu.edu
Wed Nov 19 02:30:30 CET 2003

  this is probably a very obvious question but I cant see how I can
convert a numeric vector to a single string as opposed to  a character

Essentially if I have a vector defined as

x <- c(1,2,3.76,4.56)

I would like to generate the string:

"1 2 3.76 4.56"

rather than

"1" "2" "3.76" "4.56"

which is what paste() gives me.

I thought of using a textConnection() but as far as I can see I need to
use something like writeLines which requires a character vector.


Rajarshi Guha <rxg218 at psu.edu> <http://jijo.cjb.net>
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
All great discoveries are made by mistake.
-- Young

More information about the R-help mailing list