[R] quotient and remainder

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Jun 23 09:06:03 CEST 2005


On Thu, 23 Jun 2005, zhihua li wrote:

> hi netters
>
> Is there a function in R that can compute the quotient and remainder of a 
> division calculation?   such that when 11 is given as the dividend and 5 the 
> divider, the function returns 2(quotient) and 1(remainder).


> 11 %% 5
[1] 1
> 11 %/% 5
[1] 2

See ?Arithmetic.


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list