Displaying 3 results from an estimated 3 matches for "r_set_class".
2006 Feb 27
0
method dispatch and in-place modification? - unclass, RemoveClass, getDataPart, method dispatch
...ethod("[", x, i,j, drop=TRUE)
... do more stuff depending on extraopt...
}
I have two general problems:
(1) NextMethod() really doesn't like having "extraopt" around.
(2) I can do "unclass" or "class<-" (they seems to do exactly the
same thing with R_set_class()), but it makes a new copy of the object.
The object in my case is very large - (about 80MB, and will be 10x
higher if I can get away with it) and the copying itself accounts
for 97% of the total CPU time consumed - which basically makes it
about 30 times slower than it should be.
In fact R_set_cl...
2016 Jan 05
2
For integer vectors, `as(x, "numeric")` has no effect.
...ht experiment proposal", but (based
partly on the reception its gotten) figure I mustn't be appreciating
the complications
it would introduce..
That said, if it's decided to just make a smaller fix of as(x, "numeric"),
might it be better to make the change at the C level, to R_set_class
in $RHOME/src/main/coerce.c?
Here's the 'offending' bit of R_set_class (the C-code implementing the
R function `class<-`), which treats an INTSXP in the same way as a
REALSXP, breaking before it get coerced to REALSXP:
else if(!strcmp("numeric", valueString)) {
se...
2016 Jan 05
0
For integer vectors, `as(x, "numeric")` has no effect.
...orage},
and I would guess that more code "out there in package-land and
user-code" would break than with my change.
> That said, if it's decided to just make a smaller fix of
> as(x, "numeric"), might it be better to make the change at
> the C level, to R_set_class in $RHOME/src/main/coerce.c?
I'm not seeing the advantage to make the change there, apart
from possibly some efficiency gain.
For the time being, I will not work on this ... mainly as I still
believe that my proposal would lead to a much much cleaner setup
(and yes, even be worth some small c...