[R] Recreate for loop without using for loop
Rima El-zein
R|m@@ec @end|ng |rom hotm@||@com
Sun Feb 10 17:59:41 CET 2019
Hi.
Can someone please help me recreate this code without using a for loop? Idk if I'm supposed to use a map function or something else.
qprob <- function(pp) {
qq <- 1 - pp -1
stotal <- 0.0
for (i in 1:length(pp))
stotal <- stotal + pp[i] * prod(qq[-i])
return(stotal)
}
Best regards,
Rima
Sendt fra Mail<https://go.microsoft.com/fwlink/?LinkId=550986> til Windows 10
[[alternative HTML version deleted]]
More information about the R-help
mailing list