search for: do_cum

Displaying 3 results from an estimated 3 matches for "do_cum".

Did you mean: do_csum
2020 Aug 23
2
sum() vs cumsum() implicit type coercion
...long) Error in sum(tryjpy$long) : invalid 'type' (character) of argument > cumsum(tryjpy$long) [1] 0.0022 0.0020 -0.0129 -0.0152 -0.0494 -0.0739 -0.0761 -0.0758 -0.0759 [10] -0.0763 -0.0799 -0.0809 -0.0820 -0.0832 -0.0838 -0.0822 -0.0816 Which I guess is due to the following line in do_cum(): PROTECT(t = coerceVector(CAR(args), REALSXP)); This might be fine and there may be very good reasons why there is no coercion in sum - just seems a little inconsistent in usage Cheers -- Rory
2020 Aug 25
1
sum() vs cumsum() implicit type coercion
...ment >> >>> cumsum(tryjpy$long) >> [1] 0.0022 0.0020 -0.0129 -0.0152 -0.0494 -0.0739 -0.0761 -0.0758 -0.0759 >> [10] -0.0763 -0.0799 -0.0809 -0.0820 -0.0832 -0.0838 -0.0822 -0.0816 >> >> Which I guess is due to the following line in do_cum(): >> >> PROTECT(t = coerceVector(CAR(args), REALSXP)); >> This might be fine and there may be very good reasons why there is no >> coercion in sum - just seems a little inconsistent in usage > Yes. I don't know the reason for this design, but pl...
2020 Aug 25
0
sum() vs cumsum() implicit type coercion
...ng) : invalid 'type' (character) of argument > >> cumsum(tryjpy$long) > [1] 0.0022 0.0020 -0.0129 -0.0152 -0.0494 -0.0739 -0.0761 -0.0758 -0.0759 > [10] -0.0763 -0.0799 -0.0809 -0.0820 -0.0832 -0.0838 -0.0822 -0.0816 > > Which I guess is due to the following line in do_cum(): > > PROTECT(t = coerceVector(CAR(args), REALSXP)); > This might be fine and there may be very good reasons why there is no > coercion in sum - just seems a little inconsistent in usage Yes. I don't know the reason for this design, but please note it is documented in ?sum and in...