View source: R/plot-failure-modes.R
separate_failure_modes | R Documentation |
For a data.frame
containing a column with (some) multiple failure modes,
this function expands the data.frame
by repeating each row with multiple
failure modes so that each row contains only a single failure mode.
separate_failure_modes(data, failure_mode, sep = "[/, ]+")
data |
a |
failure_mode |
the column in |
sep |
a regular expression with the character(s) separating individual
failure modes. Default |
When multiple failure modes are reported, they are commonly reported in the format "LGM/GIT" or "LGM,GIT". This function will separate these multiple failure modes into multiple rows.
This can be useful when counting the number of coupons exhibited each failure mode.
library(dplyr)
data.frame(strength = c(101, 102), fm = c("LGM/GIT", "LGM")) %>%
separate_failure_modes(fm)
##
## # A tibble: 3 × 2
## strength fm
## <dbl> <chr>
## 1 101 LGM
## 2 101 GIT
## 3 102 LGM
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.