Learn R Programming

PortfolioTesteR (version 0.1.4)

ensure_dt_copy: 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)

Value

Copy of data as data.table

Arguments

data

Data.frame or data.table

Examples

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

Run the code above in your browser using DataLab