Learn R Programming

degradr (version 1.0.1)

plot_degradr: Plot Degradation Trajectories for Multiple Units

Description

Generates a line plot of degradation signals over time for each unit, optionally overlaying a failure threshold line. This function is useful for visualizing degradation paths across multiple components or systems.

Usage

plot_degradr(data, D = NULL)

Value

Returns a ggplot object that can be further customized or directly printed.

Arguments

data

A data frame with three columns: t for time, x for the degradation signal, and unit as the unit identifier.

D

Optional numeric value indicating the failure threshold.

Details

The function is designed to work with degradation datasets where each row represents an observation of a unit at a particular time. The plot shows how the degradation variable x evolves over time t for each unit. This is especially useful for visual inspection before model fitting or threshold analysis.

Examples

Run this code
library(degradr)

# Load example data sets
data(filter_train)
data(filter_test)

# Show the original column names
colnames(filter_train)

# Rename the columns to match the expected format: t, x, unit
colnames(filter_train) <- c("t", "x", "unit")
plot_degradr(data = filter_train, D = 600)

Run the code above in your browser using DataLab