pctCen: Calculate the percentage of values censored

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/All.R

Description

pctCen is a simple, but convenient, function that calculates the percentage of censored values.

Usage

1
pctCen(obs, censored, na.action)

Arguments

obs

A numeric vector of observations. This includes both censored and uncensored observations.

censored

A logical vector indicating TRUE where an observation in v is censored (a less-than value) and FALSE otherwise.

na.action

A function which indicates what should happen when the data contain NAs. The default is set by the na.action setting of options, and is na.omit if that is unset. Another possible value is NULL, no action.

Details

100*(length(obs[censored])/length(obs))

Value

pctCen returns a single numeric value representing the percentage of values censored in the “obs" vector.

Author(s)

R. Lopaka Lee <rclee@usgs.gov>

Dennis Helsel <dhelsel@practicalstats.com>

See Also

splitQual, ros,

Examples

1
2
3
4
    obs      = c(0.5,    0.5,   1.0,  1.5,   5.0,    10,   100)
    censored = c(TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE)

    pctCen(obs, censored) 

Example output

Loading required package: survival

Attaching package: 'NADA'

The following object is masked from 'package:stats':

    cor

[1] 28.57143

NADA documentation built on March 22, 2020, 5:07 p.m.

Related to pctCen in NADA...