censor | R Documentation |
Censors a vector at user-set limits for left- or right-censoring.
censor(x, left = -Inf, right = Inf)
x |
a numeric vector. Missing values are permitted. |
left |
a vector of left-censoring thresholds. If the length is greater
than 1, then they are replicated to the length of |
right |
a vector of right-censoring thresholds. If the length is greater
than 1, then they are replicated to the length of |
An S4 object of class "lcens" if right
is Inf
, otherwise
an S4 object of class "mcens."
Missing velues are generated wherever right
is less than or equal
to left
.
The censor
function is provided as a simple function to create either left-
or multiply-censored data from numeric values, primarily for simulation pruposes.
The functions as.lcens
or as.mcens
offer greater flexibility and
should be used for real data.
Lorenz, D.L., in preparation
as.lcens
, as.mcens
## Create a random vector set.seed(651) x.tmp <- rnorm(5) censor(x.tmp, 0, .75)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.