I must say, I can't deduce, from what you have said, what the desired rounding rule is.

The following function does not do what you want, but maybe it's a little bit related...

 rounds
function (x, val = 1)
val * round(x/val)


If
     length = 12.2232
and
     delta-length = 0.4      (delta minus length, that is)
then it must be that
     delta = 11.8232
?

12.2232 rounded to the nearest multiple of 0.4 is 12.4, not 12.2, if that's what you meant by tolerance.

-Don

At 11:31 PM +0200 5/14/08, Jonas Stein wrote:
i have a table like this of an value and its tolerance

length   delta-length
12.2232  0.4
123.422  0.034123
1234     12

i want to round the value to the significant digits in this way:

my-round(length,delta-length)

12.2   ,  0.4
123.42 ,  0.03
1234   ,  12

how can i do this with R?

please CC to email,
thanks so far,

--
Jonas Stein <[EMAIL PROTECTED]>

______________________________________________
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.


--
---------------------------------
Don MacQueen
Lawrence Livermore National Laboratory
Livermore, CA, USA
925-423-1062
[EMAIL PROTECTED]

______________________________________________
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