Learn R Programming

rENA (version 0.3.0)

fun_skip_sphere_norm: Row-wise Max-Norm Scaling

Description

Scales all rows of a numeric dataframe by dividing by the largest row vector length (L2 norm) found in the dataframe. This preserves the relative magnitudes between rows but does not normalize each row to unit length. Useful for analyses where relative scale is important but full normalization is not desired.

Usage

fun_skip_sphere_norm(dfM)

Value

A numeric matrix with the same dimensions as `dfM`, with all values divided by the largest row L2 norm.

Arguments

dfM

A data.frame or matrix. Each row is treated as a vector to compute its L2 norm.

Details

Row-wise Max-Norm Scaling

This function finds the row with the largest L2 norm (Euclidean length) and divides all entries in the matrix by this value. It does not normalize each row individually.

Examples

Run this code
df <- data.frame(a = c(3, 4), b = c(0, 0))
fun_skip_sphere_norm(df)

Run the code above in your browser using DataLab