On Fri, 2009-05-29 at 12:39 -0500, Erin Hodgess wrote:
> Dear R People:
> 
> I have the following vector and am using the paste command:
> 
> > ya
> [1] 57  2  8
> > paste("stuff",ya,sep=" ")
> [1] "stuff 57" "stuff 2"  "stuff 8"
> 
> What I want to have is
> "stuff 57 2 8"
> 
> 
> I also tried:
> > yb <- paste(cat("stuff",ya))
> stuff 57 2 8> yb
> character(0)
> 
> I have the feeling that it's really simple and right in front of me.

You need (or rather, "one way is") to collapse the 'ya'

> paste("stuff", paste(ya, collapse = " "))
[1] "stuff 57 2 8"

HTH

G

> 
> Thanks,
> Erin
> 
> 
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

Attachment: signature.asc
Description: This is a digitally signed message part

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to