[Rd] all.equal(data.frame(package_version()), ...) infinite recursion

William Dunlap wdunlap at tibco.com
Tue Apr 12 17:32:41 CEST 2011


With R-2.12.2 on Linux:

  > z <- data.frame(Version=package_version(c("0.1")),
row.names=c("pkgA"))
  > all.equal(z, z) # expect TRUE
  Error: evaluation nested too deeply: infinite recursion /
options(expressions=)?
  > traceback()
  ... lots of lines in a 3-cycle ...
  6: all.equal.list(target, current, ...)
  5: all.equal.default(target[[i]], current[[i]], check.attributes =
check.attributes,
         ...)
  4: all.equal(target[[i]], current[[i]], check.attributes =
check.attributes,
         ...)
  3: all.equal.list(target, current, ...)
  2: all.equal.default(z, z)
  1: all.equal(z, z)

This is probably because the [[ method for package_version
([[.numeric_version)
acts like a typical [ method, not a [[ method, so all.equal's call to [[
does
not burrow into the list:
  > is.list(z$Version)
  [1] TRUE
  > identical(z$Version[[1]], z$Version)
  [1] TRUE

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com 



More information about the R-devel mailing list