R script for Fr