# Error detection when using package "plyr"

#### jpkelley

##### TS Contributor
Problem: I'm running a custom function on subsets of a data.frame using the dlply function in Wickham's package "plyr." It threw an error related to the ID variable (on which the subsetting is based), and I've been trying to figure out which of the IDs is causing the issue.

I added the progress bar (text) and found that the error is occurring when progress = 55%. I assume that dlply is running in order of unique(ID), so I could see which level of the ID is about 55% along the unique(ID) vector. Again, this is an assumption.

Anybody know if there's a way to uncover where dlply is stopping?

[EDIT: I ended up just making another function to output list elements as they finished and this solved my problem. This was manageable for the length of IDs in my dataset, but I can imagine this being very laborious for larger datasets. If there are options within plyr (or other functions), please advise! ]

Last edited:

#### jpkelley

##### TS Contributor
Well. Talk about amateur hour. Well, just now learning traceback() let me take one step further out of the amateur jungle. Thanks, trinker.

What I did (for future readers):
- I ran traceback() and found the progress$step() where the error occurred. In this case, it was element 122, designated something like "(122L)". - I sorted my unique ID labels using "sort(unique(dataset$ID))" and found that the 122nd reference ID was where the error had first occurred and caused the function to stop.

Thanks again, trinker. Huge help.

Last edited: