I'm late to the party, and sorry if I missed a discussion on this, but is there a way to dump() an S7 object? Attempting to do so gives:
> x <- S7::S7_object()
> dump("x", file = stdout())
x <-
<object>
Warning message:
In dump("x", file = stdout()) : deparse may be incomplete
which is not valid R code.
Ultimately, I want to create a minimal, valid S7_object object without using the 'S7' package. I want this in order to write a teeny 'codetools'-related unit test, without having to depend on the 'S7' package. Thus far, I know I can save an S7_object object to an RDS file, and obtain such a "creature" without having the 'S7' package installed, e.g.
> z <- readRDS("s7.rds")
> z
<object>
attr(,"class")
[1] "S7_object"
but it would be nice not to rely on a binary representation for my unit tests.
I'm late to the party, and sorry if I missed a discussion on this, but is there a way to
dump()an S7 object? Attempting to do so gives:which is not valid R code.
Ultimately, I want to create a minimal, valid
S7_objectobject without using the 'S7' package. I want this in order to write a teeny 'codetools'-related unit test, without having to depend on the 'S7' package. Thus far, I know I can save anS7_objectobject to an RDS file, and obtain such a "creature" without having the 'S7' package installed, e.g.but it would be nice not to rely on a binary representation for my unit tests.