Skip to contents

Removes all attributes from an object except for names, row.names, and class. This is useful for testing scenarios where you want to simulate data frames without custom attributes (e.g., fitted model objects stored as attributes).

Usage

strip_attributes(x)

Arguments

x

An R object (typically a data frame)

Value

The same object with all non-essential attributes removed

Examples

if (FALSE) { # \dontrun{
# Create a data frame with custom attributes
df <- data.frame(x = 1:3, y = 4:6)
attr(df, "custom_attr") <- "some_value"

# Strip custom attributes
df_clean <- strip_attributes(df)
# df_clean will have only names, row.names, and class attributes
} # }