Playing with R  - split/apply/combine