mages / ChainLadder

Claims reserving models in R
https://mages.github.io/ChainLadder/
78 stars 64 forks source link

as.triangle for data.frame has bug with column names #60

Closed edwardtasker closed 5 years ago

edwardtasker commented 5 years ago

Line 85 in "Triangles.R" has a bug which leads to incorrect naming of columns:

In the following code, the order of "dev" and "origin" are swapped in the aggregate function and the line which names the columns.

aggTriangle <- stats::aggregate(Triangle[[value]], list(Triangle[[dev]], Triangle[[origin]]), sum) names(aggTriangle) <- c(origin, dev, value)

mages commented 5 years ago

Thanks for reporting! Should be fixed now in the version on GitHub

ChainLadder 0.2.9 with the fix is on its way to CRAN.