Dear list, I have following list [[1]] Pnr time CA CACen 1 6208301454 1 0.008 TRUE 2 6208301454 2 0.008 TRUE 3 6208301454 3 0.008 FALSE 4 6208301454 4 0.013 TRUE 5 6208301454 5 0.007 FALSE [[2]] Pnr time CA CACen 1 6403147116 1 0.020 FALSE 2 6403147116 2 0.089 FALSE 3 6403147116 3 0.020 FALSE 4 6403147116 4 0.025 FALSE 5 6403147116 5 0.012 FALSE [[3]] Pnr time CA CACen 1 4905127413 1 0.008 TRUE 2 4905127413 2 0.007 TRUE 3 4905127413 3 0.003 TRUE 4 4905127413 4 0.006 TRUE [[4]] Pin time CA CACen 1 5009277137 1 0.008 TRUE 2 5009277137 2 0.009 TRUE 3 5009277137 3 0.008 FALSE 4 5009277137 4 0.009 FALSE 5 5009277137 5 0.008 FALSE How do I tell R to select the listelements containing both TRUE and FALSE to calculate the weighted means and those with only TRUE or FALSE to calculate the aritmetic means and then put all the means together in a dataframe. The result should look like Pnr Mean 6208301454 weighted mean 6403147116 arith. mean 4905127413 arith. mean 5009277137 weighted mean Thanks for any help, Tom --------------------------------- Låna pengar utan säkerhet. Sök och jämför lån hos Kelkoo. [[alternative HTML version deleted]]