adding some R code that might be of use... or not