Quick Fix R Function