[R] using S4 objects in "with"?
Spencer Graves
@pencer@gr@ve@ @ending from effectivedefen@e@org
Wed Sep 26 22:16:33 CEST 2018
Is there anything comparable to "with" for S4 objects?
EXAMPLE:
A "Wave" object in the tuneR package has slots "left" and
"right", plus others. I'd like to be able to do something like the
following:
library(tuneR)
x <- seq(0, 2*pi, length = 6)
all.equal(x, rev(x))
channel <- round(32000 * sin(440 * x))
Wobj <- Wave(left = channel, right=rev(channel))
with(Wobj, quantile(left-right))
** This last statement throws "Error ... object 'left' not found".
Is there something comparable to "with" that can do this?
Thanks,
Spencer Graves
More information about the R-help
mailing list