calculate RFM in civicrm
You'll need a custom report template for that! We have written donor segmentation reports with all kinds of metrics - RFM is just another set of metrics/calculations;

This is still a really good reference to get started on custom reports: https://alastaira.wordpress.com/2011/03/17/civicrm-creating-a-custom-report/