File: idiv.Rd

package info (click to toggle)
r-cran-iterators 1.0.7-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 532 kB
  • sloc: sh: 29; makefile: 1
file content (41 lines) | stat: -rw-r--r-- 1,201 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
\name{idiv}
\alias{idiv}
\title{Dividing Iterator}
\description{
  Returns an iterator that returns pieces of numeric value.
}
\usage{
idiv(n, ..., chunks, chunkSize)
}
\arguments{
  \item{n}{number of times that the iterator will fire.
           If not specified, it will count forever.}
  \item{\dots}{unused.}
  \item{chunks}{the number of pieces that \code{n} should be divided into.
           This is useful when you know the number of pieces that you want.
           If specified, then \code{chunkSize} should not be.}
  \item{chunkSize}{the maximum size of the pieces that \code{n}
           should be divided into.
           This is useful when you know the size of the pieces that you want.
           If specified, then \code{chunks} should not be.}
}
\value{
  The dividing iterator.
}
\examples{
  # divide the value 10 into 3 pieces
  it <- idiv(10, chunks=3)
  nextElem(it)
  nextElem(it)
  nextElem(it)
  try(nextElem(it))  # expect a StopIteration exception

  # divide the value 10 into pieces no larger than 3
  it <- idiv(10, chunkSize=3)
  nextElem(it)
  nextElem(it)
  nextElem(it)
  nextElem(it)
  try(nextElem(it))  # expect a StopIteration exception
}
\keyword{utilities}