[R] Is there in R a function equivalent to the mround, as found in most spreadsheets?

Charilaos Skiadas cskiadas at gmail.com
Fri May 9 12:18:37 CEST 2008


On May 9, 2008, at 5:39 AM, Dieter Menne wrote:

> Dr. Ottorino-Luca Pantani <ottorino-luca.pantani <at> unifi.it>  
> writes:
>>
>> Imagine that for a particular cuvette (I have 112 different  
>> cuvettes !!)
>> you have to mix the following volumes of solution A, B, and C  
>> respectively.
>>
>> c(1803.02, 193.51, 3.47)
>>
>> Each solution is to be taken with 3 different pipettes (5000, 250  
>> and 10
>> µL Volume max) and each of those delivers volumes in steps of 50  
>> µL,  5
>> µL  or 1µL, respectively

>> Since the above values  would eventually become
>>
>> c(1800, 195, 3)
>>
>> it is then necessary to recalculate all the final concentrations
>> of A, B and C, because the volumes are changed.
>
> A first guess would be
>
> a = c(1803.02, 193.51, 3.47)
> round(a / 5)*5
>
> which gives
>
> 1805  195    5


If I understand the OP's question properly, the first value is to be  
a multiple of 50, the second a multiple of 5, and the third a  
multiple of 1. This can be done with this slight variation on the  
above theme:

a <- c(1803.02, 193.51, 3.47)
b <- c(50,5,1)
round(a/b) *b

> This is not exactly what you want, but it shows that the problem is  
> a bit
> ill-defined. In the example you gave, why do you want 1800, and not  
> 1805, which
> is possible with the pipettes? I assume that you laboratory  
> experience is
> working in the background, telling you to stop pipetmanning when  
> you are close
> to the result in some "percentage" feeling.
>
> Dieter

Haris Skiadas
Department of Mathematics and Computer Science
Hanover College



More information about the R-help mailing list