Re: [R] vector sprintf argument

2007-11-29 Thread Christos Hatzis
[EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Moshe Olshansky > Sent: Thursday, November 29, 2007 11:45 PM > To: Tom Sgouros; r-help@r-project.org > Subject: Re: [R] vector sprintf argument > > The only thing I can think of is: > > > a <- c(1,2.7,5.19) &g

Re: [R] vector sprintf argument

2007-11-29 Thread Moshe Olshansky
The only thing I can think of is: > a <- c(1,2.7,5.19) > F<-c("numeric: %d ","%g ","%8.3f") > x<-sapply(1:length(a),function(i) sprintf(F[i],a[i])) > y<-paste(x,sep="",collapse="") But I am sure that you will get a better advice elsewhere. --- Tom Sgouros <[EMAIL PROTECTED]> wrote: > > Hello

Re: [R] vector sprintf argument [SEC=UNCLASSIFIED]

2007-11-29 Thread Crombie, Joe
e- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tom Sgouros Sent: Friday, 30 November 2007 12:43 PM To: r-help@r-project.org Subject: [R] vector sprintf argument Hello all: If I have a vector and a format, I want to do this: > A <- c(3,4,5) > F <- "Number:

[R] vector sprintf argument

2007-11-29 Thread Tom Sgouros
Hello all: If I have a vector and a format, I want to do this: > A <- c(3,4,5) > F <- "Number: %d, %d, %d" > sprintf(F,A) This doesn't work because A isn't three arguments, it's just one. Is there a way to peel the vector members out of A so that sprintf can get at them? I would like to do