Hi,
> # create a TestObj
> lala <- new("TestObj", id = "test", dt = data.table(a=1:10, b=11:20))
>
> # accessing the data.table slot results in a copy :-(
> lala@dt <- lala@dt[, c1 := a + b]
You are reassigning to the object here, what if you were to do this:
R> lala@dt[, c1 := a + b]
Accessing S4 object directory via their slot (ie using @) is
discouraged, but I'm not how it would work if you did the same using a
function. For example you might create a function `dt` that returns
the object in the @dt slot then work on it directly:
R> dt(lala)[, c1 := a + b]
Perhaps you can play with those and let us know if either is satisfactory?
-steve
--
Steve Lianoglou
Computational Biologist
Genentech
_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help