I need to create a function cprod -> that takes a numeric vector as an argument and returns a cumulative vector of the same length. So, if I have cprod(c(1,2,3)), the returning vector should be c (1, 1 * 2, 1 * 2 * 3) = c (1, 2, 6).
Can this be done without cumprod? Maybe with prod or for-loop?