How to run a simple for loop with a function within in R?
In the following dataset, I want to computer the function decostand every 72 rows. Do this 10 times. Here is what I tried. library(vegan) library(truncnorm) df <- data.frame(set = rep(c(1:10), each = 72), sp1 = rep(rtruncnorm(72, a=0, b=800, mean = 50, sd = 20), times = 10), sp2 = rep(rtruncnorm(72, a=0, b=800, mean = 70,… Read More How to run a simple for loop with a function within in R?