truncate: Truncate a Data Frame or Matrix

View source: R/truncate.R

truncateR Documentation

Truncate a Data Frame or Matrix

Description

Remove all rows from a literature matrix but preserve the general structure. Mimics SQL's TRUNCATE operation by clearing data while preserving structure.

Usage

truncate(.data, keep_rows = FALSE)

Arguments

.data

A data frame or matrix to be truncated

keep_rows

Logical. If TRUE, replaces non-NA values with NA instead of removing all data

Value

An empty data frame or matrix with the same structure as the input

Examples

# Completely empty a data frame
df <- data.frame(x = 1:3, y = 4:6)
truncate(df)

# Replace non-NA values with NA while keeping structure
truncate(df, keep_rows = TRUE)


matriz documentation built on April 3, 2025, 7:22 p.m.