Call R script from leg_preferences command