renaming 'df' to 'd' inside functions called from ddply