Learn R Programming

weibulltools (version 2.0.0)

reliability_data: Reliability Data

Description

Create consistent reliability data based on an existing data.frame (preferred) or on multiple equal length vectors.

Usage

reliability_data(data = NULL, x, status, id = NULL, .keep_all = FALSE)

Value

A tibble with class wt_reliability_data containing the following columns (if .keep_all = FALSE):

  • x : Lifetime characteristic.

  • status : Binary data (0 or 1) indicating whether a unit is a right censored observation (= 0) or a failure (= 1).

  • id : Identification for every unit.

If .keep_all = TRUE, the remaining columns of data are also preserved.

Arguments

data

Either NULL or a data.frame. If data is NULL, x, status and id must be vectors containing the data. Otherwise x, status and id can be either column names or column positions.

x

Lifetime data, that means any characteristic influencing the reliability of a product, e.g. operating time (days/months in service), mileage (km, miles), load cycles.

status

Binary data (0 or 1) indicating whether a unit is a right censored observation (= 0) or a failure (= 1).

id

Identification of every unit.

.keep_all

If TRUE keep remaining variables in data.

Examples

Run this code
# Example 1 -  Based on an existing data.frame/tibble and column names:
data <- reliability_data(
  data = shock,
  x = distance,
  status = status
)

# Example 2 - Based on an existing data.frame/tibble and column positions:
data_2 <- reliability_data(
  data = shock,
  x = 1,
  status = 3
)

# Example 3 - Keep all variables of the tibble/data.frame entered to argument data:
data_3 <- reliability_data(
  data = shock,
  x = distance,
  status = status,
  .keep_all = TRUE
)

# Example 4 - Based on vectors:
cycles   <- c(300, 300, 300, 300, 300, 291, 274, 271, 269, 257, 256, 227, 226,
              224, 213, 211, 205, 203, 197, 196, 190, 189, 188, 187, 184, 180,
              180, 177, 176, 173, 172, 171, 170, 170, 169, 168, 168, 162, 159,
              159, 159, 159, 152, 152, 149, 149, 144, 143, 141, 141, 140, 139,
              139, 136, 135, 133, 131, 129, 123, 121, 121, 118, 117, 117, 114,
              112, 108, 104, 99, 99, 96, 94)
state <- c(rep(0, 5), rep(1, 67))
id <- "XXXXXX"

data_4 <- reliability_data(
  x = cycles,
  status = state,
  id = id
)

Run the code above in your browser using DataLab