Displaying 1 result from an estimated 1 matches for "do_the_mod_in_c_r".
2013 Nov 22
2
what is the correct way to force a copy of an object?
...irm this. But
for some reason our function is not triggering the copy.
We have been able to kludge it to force a copy and behave as expected by
making a slight modification to the object before passing it to .Call:
modificationFun <- function(x){
x$ForceCopy<-NULL
x<-.Call("do_the_mod_in_c_R", package='mypackage')
invisible(x)
}
What is the correct way to force the copy to occur to avoid
inadvertently modifying both instances of the object? Neither force()
or eval() seem to do this.
Would it be faster to call duplicate(x) inside the C function instead of
forcing...