Looping over unique pairs of elements in a list in R
问题 Suppose I have a list of objects called bb . I want to pick each unique pair of elements in bb and use them in some kind of function (called convolve ) as shown below: ## Below `bb` elements: `bma1` & `bma2` are used in the function: con <- convolve(dens1= bb$bma1$dposterior, dens2= function(x){bb$bma2$dposterior(-x)}, cdf1= bb$bma1$pposterior, cdf2= function(x){1 - bb$bma2$pposterior(-x)}) con$quantile(c(0.025, 0.975)) Question: bb can have any number of elements but convolve() accepts only