Re: [R] Decimal places in a function output

2010-11-10 Thread Marc Schwartz
On Nov 10, 2010, at 9:51 AM, Liliana Pacheco wrote: > Hi R users > I have a very simple function. As the return of that function I want the > answer with 5 decimal places, but it hasn't worked with sprintf, nor with > format, nor print. This is how I used sprintf: > > cuant<-function(r,n){ > d<-s

Re: [R] Decimal places in a function output

2010-11-10 Thread Duncan Murdoch
On 10/11/2010 10:51 AM, Liliana Pacheco wrote: Hi R users I have a very simple function. As the return of that function I want the answer with 5 decimal places, but it hasn't worked with sprintf, nor with format, nor print. This is how I used sprintf: cuant<-function(r,n){ d<-seq(-1,1,by=0.001)

[R] Decimal places in a function output

2010-11-10 Thread Liliana Pacheco
Hi R users I have a very simple function. As the return of that function I want the answer with 5 decimal places, but it hasn't worked with sprintf, nor with format, nor print. This is how I used sprintf: cuant<-function(r,n){ d<-seq(-1,1,by=0.001) . . . (SOME CALCULATIONS) . . . return(sprintf("%