Posts by Cezar • 123 points
1 post
-
1
votes3
answers830
viewsA: Loop in R with indexing and matrix
Assuming a normal distribution of mean 0 and standard deviation 1: x <- rnorm(1000, mean = 0, sd = 1) z <- c(1, 2, 3, 4, 5) Y <- matrix(NA, 1000, 0) for (i in z) { y <- 5 + 3*x + 4*i Y…