I'm trying to do a calculation and I need your help. First I make a normal distribution sequence with 420 numbers, then I make a sequence of numbers that I call mci
with 42 numbers, then the next calculation has a if
condition.
In this part I need that in my condition always compare the first vector list of mci
with the first number of the values that I generated from my normal distribution, then the whole process is repeated with the second number until completing the 420.
For example: For rp = (28, 27, 26 ...), bwg = (count with mci [i]) > rp
I want this rp
to always be 28 until the first sequence of 42 numbers ends, and then compare to 27 of the second sequence of my vector.
Note that the condition always always compares the same value of rp
, and I think that R is not doing this, comparing for example the value 26,912 with 0,435 where it should compare with the 0,429
max <- 30
K <- 0.0118
Xm <- 21
SD <- 0.851636356306513
mean.b <- 28
rp <- rnorm(420, mean = mean.b, sd = SD)
BW <- 0.0223*rp^0.8944
mci <- seq(200, 270, 1.7)
bwg <- ifelse((max*(1-exp(-K*(MCi-(BW*Xm))))) > rp, yes = rp, no = (max*(1-exp(-K*(MCi-(BW*Xm))))))