R portfolio code