[R] Is there in R a function equivalent to the mround, as found in most spreadsheets?
Duncan Murdoch
murdoch at stats.uwo.ca
Tue May 6 18:43:16 CEST 2008
On 5/6/2008 12:07 PM, Dr. Ottorino-Luca Pantani wrote:
> Dear R-users,
> I have the following problem
>
> In a lab experiment I have to mix three solutions to get different
> concentrations of various molecules in a cuvette
>
> I've used R to calculate the necessary µliters for each of the level of
> the experiment and I must confess that it is more useful and easier to
> achieve the results than using spreadsheets.
>
> But there's a problem.
>
> 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.
>
>
> I know that in most spreadsheets (Calc in Open Office, Gnumeric, Excel
> and so on)
> there's a function such as
>
> mround(num; num)
>
> that give the results I need, but I want to learn more on R functions.
>
>
> I played a little with R functions such as
>
> round, signif, ceiling, trunc, and floor
>
> but without success.
> Any hint to solve this problem ?
I believe this function matches the description in OOO:
mround <- function(number, multiple) multiple * round(number/multiple)
Duncan Murdoch
More information about the R-help
mailing list