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

From: Charilaos Skiadas <cskiadas_at_gmail.com>
Date: Fri, 09 May 2008 06:18:37 -0400

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



R-help_at_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. Received on Fri 09 May 2008 - 10:22:25 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 09 May 2008 - 16:30:37 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive