For the specific example in the question:
DT <- read.table(text="id score
1 0.5
1 0.7
1 0.8
2 0.7
2 0.8
2 0.9 ", header=TRUE)
library(data.table)
setDT(DT)
DT[, new := 10*cumprod(score), by=id]
# id score new
#1: 1 0.5 5.00
#2: 1 0.7 3.50
#3: 1 0.8 2.80
#4: 2 0.7 7.00
#5: 2 0.8 5.60
#6: 2 0.9 5.04
In the more general case you'd need Reduce
where I have used cumprod
.