3

I'm running into an issue where plyr consistently crashes when an error is thrown from the supplied function

> require(plyr)
Loading required package: plyr
Warning message:
package ‘plyr’ was built under R version 3.0.2 
> df <- data.frame(group=c("A","A","B","B"), num=c(11,22,33,44))
> ddply(df, .(group), function(x) {x})
  group num
1     A  11
2     A  22
3     B  33
4     B  44

> ddply(df, .(group), function(x) {stop("badness")})
called from: (function ()
{
     .rs.breakOnError(TRUE)
})()
Error in .fun(piece, ...) : badness
Browse[1]>
# Crashes immediately

Is anyone aware of why this may be occuring and how to prevent it (other than avoiding errors of course)?

(I'm running R 3.0.1 on platform: i386-w64-mingw32/i386 (32-bit) through RStudio 0.98.274 under Windows 7)

EDIT As a workaround, I am redirecting any errors as warnings which avoids the crashes

ddply(df, .(group), function(x) tryCatch(stop("badness"), error = function(e) warning(e)) )

Will report what happens here if I manage to align the plyr and R versions.

ScarletPumpernickel
  • 678
  • 1
  • 7
  • 22

1 Answers1

2

I got the same issue on R 3.1.1 and plyr 1.8.1.

To fix it, I just reinstalled the package from source.

install.packages("plyr", type = "source")
Lionel Henry
  • 6,652
  • 27
  • 33
  • Actually I just reinstalled the binary to see if that really was the problem, but I couldn't reproduce the bug. So if you have these crashes, just reinstall plyr from source or from the binary and see how it goes. – Lionel Henry Jul 28 '14 at 07:56
  • I was getting a totally different error related to plyr, and this solution fixed that also. Must be a problem with the "normal" installed version! Thanks – Luke Mar 10 '15 at 11:07