Are you looking for something like this?
x <- rnorm(n = 10)
y <- sapply(X = x,
FUN = function(t)
{
temp <- rnorm(n = 5)
std_temp <- scale(x = temp,
scale = FALSE)
return(std_temp - (t / 5))
})
y
#> [,1] [,2] [,3] [,4] [,5] [,6]
#> [1,] -0.78447371 0.2982795 0.3188463 1.2688983 -0.3447385 0.5116717
#> [2,] 0.36055242 -2.3718419 -0.2294217 0.6236303 0.5936671 0.6530591
#> [3,] -0.37618191 0.8355898 0.2671856 -0.7449741 -0.2968168 -2.3798615
#> [4,] 0.63759853 2.4088066 0.3548191 -0.4620816 -0.7909975 -0.2509536
#> [5,] 0.05087553 -0.2942573 -0.2215604 -0.5095958 0.3520312 0.0117008
#> [,7] [,8] [,9] [,10]
#> [1,] -0.01016194 0.57710747 -0.39538632 0.26427684
#> [2,] 1.40631458 1.05989171 -0.63790931 1.62911131
#> [3,] 1.18464826 -0.07724773 -0.25789336 -1.60000096
#> [4,] -0.48098178 -1.35590209 0.05574678 -1.63405475
#> [5,] -0.84194538 -0.56453635 0.05751673 0.09449964
data.frame("Col_Sum_y" = colSums(x = y),
"x" = x)
#> Col_Sum_y x
#> 1 -0.1116291 0.1116291
#> 2 0.8765767 -0.8765767
#> 3 0.4898690 -0.4898690
#> 4 0.1758771 -0.1758771
#> 5 -0.4868545 0.4868545
#> 6 -1.4543835 1.4543835
#> 7 1.2578737 -1.2578737
#> 8 -0.3606870 0.3606870
#> 9 -1.1779255 1.1779255
#> 10 -1.2461679 1.2461679