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

Ottorino-Luca Pantani ottorino-luca.pantani at unifi.it
Fri May 9 15:02:08 CEST 2008


Charilaos Skiadas ha scritto:
> On May 9, 2008, at 5:39 AM, Dieter Menne wrote:
>
> 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 exactly was I was looking for, and you understand it properly.
Sorry for the double post, but I'm experiencing problems with my account 
in this list

>
>> 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
No, even if there's a lab background working behind, I'm only 
transferring some experience with spreadsheets to R.

I want (actually "the pipette wants") 1800 instead that 1805 since the 
larger volumes are to be delivered with a digital pipette whose step is 50.

Thanks to all the people who contributed. This list is always a great 
source.

8rino



More information about the R-help mailing list