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("%.5f",d[i-1]))
}

d is a vector with the numbers I need, specially the last one.

how can I get the resulting number of the function with a certain amount of
decimal places?

Thanks.

Liliana Pacheco

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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