In some ways this is better, and in others it is much worse. Using named constants instead of magic numbers, and breaking up complex logic into simpler named parts is a huge win for readability/maintainability, as any programmer quickly learns. The big one liner would be a lot nicer in about 3-4 chunks. I’d rewrite this example as something like: num.steps [I’m not an R guy, so that might not be the most typical styl…
For example:
replicate(2, rnorm(2))
creates a 2x2 matrix of independent random values. Whereas: x
Instead creates a 2x2 matrix with a single random value for each row, repeated across all columns. And so if you want to decompose it, you need to do: x
Which will re-call x twice inside the replicate function.