I am stuck trying to write a function that will calculate n! for each element of a vector without using if/then statements, the factorial function, or a loop. I know cumprod can be used for this but can't get it to work.
#Code
x <- c(5, 2, 3, 8, 8, 1, 1, 7)
(y <-cumprod(x[i:1]))