Description Usage Arguments Details Value Note Author(s) References Examples
maxChar
returns the number of printed characters for the widest element of x
.
prev
calculates the previous element for each element in x
.
nxt
calculates the next element for each element in x
.
runhead
determines whether each element is the ‘head’ (start) of a run.
1 2 3 4 |
x |
vector |
If you forget to round
or signif
a numeric column, you may get more digits
than desired in your output file; maxChar
can warn you. See examples.
prev
is used by runhead
. Note that there is no element previous to the first
element in a vector, so prev
returns NA
in that position. nxt
is
the reverse of prev
(literally). Note that next
is a reserved
language word in R.
If a ‘run’ is a sequence (possibly of length one) of identical successive values
in a vector, runhead
determines whether an element is the first in such a sequence.
Note that by definition, the first element is the start of a run; thus runhead
returns TRUE
in that position, even though prev
returns NA
.
maxChar
: a scalar integer
prev
: a vector of the same class
nxt
: a vector of the same class
runhead
: a vector of logicals
NA
s in the argument to runhead
give surprising but reasonable results. It cannot
be known whether they are the heads of runs, nor can it be known whether values
immediately following them are heads of runs. To treat NA
s deterministically,
convert to some definite value first.
Tim Bergsma
http://metrumrg.googlecode.com
1 2 3 4 5 6 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.