This function transforms a dataset from absolute to relative frequencies (by row or column).
Examples
dat <- matrix(rnorm(50),ncol=5,nrow=10)
TSS(dat) #It can be checked that, after scaling, the sum of each row is equal to 1.
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 1.43806872 -0.9416164 -4.15353258 2.01655612 2.64052413
#> [2,] 0.46900078 0.1725816 0.45617564 -0.22870497 0.13094692
#> [3,] -0.41912320 0.7274180 0.11562066 0.96575711 -0.38967257
#> [4,] -0.01235565 0.3247622 1.82900696 -1.36819684 0.22678336
#> [5,] 3.92027065 -1.6891528 -0.24846971 -0.28816059 -0.69448754
#> [6,] -0.11017992 1.1816623 -0.77803531 -0.27450691 0.98105988
#> [7,] 1.51923631 -3.4823223 3.54626827 0.01138901 -0.59457125
#> [8,] 0.07098454 0.2455246 0.35394006 -0.05860890 0.38815973
#> [9,] 0.52937470 -0.1910700 -0.09529976 0.47688527 0.28010981
#> [10,] -0.23579134 0.1993244 0.66993700 0.28426276 0.08226719