Problem
The value returned by MackChainLadder() depends on whether Triangle is passed directly (i.e. as a function argument) or using magrittr's pipe operator (%>%):
library(ChainLadder)
library(magrittr)
# Pass Triangle directly
mcl <- MackChainLadder(RAA)
# Pipe Triangle
mcl_piped <- RAA %>%
MackChainLadder()
identical(mcl, mcl_piped) # Returns FALSE
Further information
Differences are in elements "call" and "Model":
idx.diff <- which(vapply(
seq_along(mcl),
function(i) !identical(mcl[[i]], mcl_piped[[i]]),
logical(1))
)
names(mcl)[idx.diff]
Arguably, the only difference is in the original name of the Triangle object. This difference may look minor and cosmetic. However, it will create confusion to anybody trying verify that two pieces of code lead to the same outcome. Also, pipes are so prevalent these days that they shouldn't be ignored.
System info
I am using the current GitHub version of ChainLadder. Here's my sessionInfo():
R version 3.5.0 (2018-04-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server 7.5 (Maipo)
Matrix products: default
BLAS: /opt/R/3.5.0/lib64/R/lib/libRblas.so
LAPACK: /opt/R/3.5.0/lib64/R/lib/libRlapack.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] magrittr_1.5 ChainLadder_0.2.6
loaded via a namespace (and not attached):
[1] biglm_0.9-1 statmod_1.4.30 zoo_1.8-2 tidyselect_0.2.4 purrr_0.2.5
[6] reshape2_1.4.3 splines_3.5.0 haven_1.1.1 lattice_0.20-35 carData_3.0-1
[11] colorspace_1.3-2 stats4_3.5.0 yaml_2.1.19 rlang_0.2.1 pillar_1.2.3
[16] foreign_0.8-70 glue_1.3.0 tweedie_2.3.2 readxl_1.1.0 bindrcpp_0.2.2
[21] bindr_0.1.1 plyr_1.8.4 stringr_1.3.1 munsell_0.5.0 cplm_0.7-7
[26] gtable_0.2.0 cellranger_1.1.0 zip_1.0.0 expint_0.1-4 coda_0.19-1
[31] systemfit_1.1-22 rio_0.5.10 forcats_0.3.0 lmtest_0.9-36 curl_3.2
[36] Rcpp_0.12.17 scales_0.5.0 abind_1.4-5 ggplot2_3.0.0 stringi_1.2.3
[41] openxlsx_4.1.0 dplyr_0.7.6 grid_3.5.0 tools_3.5.0 sandwich_2.4-0
[46] lazyeval_0.2.1 tibble_1.4.2 car_3.0-0 pkgconfig_2.0.1 MASS_7.3-50
[51] Matrix_1.2-14 data.table_1.11.4 actuar_2.3-1 assertthat_0.2.0 minqa_1.2.4
[56] R6_2.2.2 nlme_3.1-137 compiler_3.5.0
Problem
The value returned by
MackChainLadder()depends on whetherTriangleis passed directly (i.e. as a function argument) or usingmagrittr's pipe operator (%>%):Further information
Differences are in elements "call" and "Model":
Arguably, the only difference is in the original name of the Triangle object. This difference may look minor and cosmetic. However, it will create confusion to anybody trying verify that two pieces of code lead to the same outcome. Also, pipes are so prevalent these days that they shouldn't be ignored.
System info
I am using the current GitHub version of ChainLadder. Here's my sessionInfo():