ensure_dt_copy: Ensure Data.Table Without Mutation

View source: R/utils.R

ensure_dt_copyR Documentation

Ensure Data.Table Without Mutation

Description

Converts input to data.table if needed, always returning a copy to prevent accidental data mutation. Core safety function used throughout the library.

Usage

ensure_dt_copy(data)

Arguments

data

Data.frame or data.table

Value

Copy of data as data.table

Examples

data("sample_prices_weekly")
dt <- ensure_dt_copy(sample_prices_weekly)  # Safe to modify dt

PortfolioTesteR documentation built on Nov. 5, 2025, 5:23 p.m.