Remove all rows from a literature matrix but preserve the general structure. Mimics SQL's TRUNCATE operation by clearing data while preserving structure.
Examples
# Completely empty a data frame
df <- data.frame(x = 1:3, y = 4:6)
truncate(df)
#> [1] x y
#> <0 rows> (or 0-length row.names)
# Replace non-NA values with NA while keeping structure
truncate(df, keep_rows = TRUE)
#> x y
#> 1 NA NA
#> 2 NA NA
#> 3 NA NA