Displaying 3 results from an estimated 3 matches for "dongcan".
Did you mean:
dongan
2015 May 17
1
The function cummax() seems to have a bug.
...tion cummax() seems to have a bug.
> x <- c(NA, 0)
> storage.mode(x) <- "integer"
> cummax(x)
[1] NA 0
The correct result of this case should be NA NA. The mistake in [
https://github.com/wch/r-source/blob/trunk/src/main/cum.c#L130-L136] may be
the reason.
Best Regards,
Dongcan
--
Dongcan Jiang
Team of Search Engine & Web Mining
School of Electronic Engineering & Computer Science
Peking University, Beijing, 100871, P.R.China
[[alternative HTML version deleted]]
2015 May 06
1
Shouldn't vector indexing with negative out-of-range index give an error?
...elements in -i".
>
> > Suggesting that no bounds checking on -i takes place.
>
> > John
>
> Indeed!
> Thanks a lot John, for the perspective and clarification!
>
> I'm committing a patch to the documentation now.
Thank you both and also credits to Dongcan Jiang for pointing out to
me that errors were indeed not generated in this case.
I agree with the decision. It's interesting to notice that now the
only way an error is generated is when index-vector subsetting is done
using mixed positive and negative indices, e.g. x[c(-1,1)].
/Henrik
>...
2015 May 04
4
Shouldn't vector indexing with negative out-of-range index give an error?
In Section 'Indexing by vectors' of 'R Language Definition'
(http://cran.r-project.org/doc/manuals/r-release/R-lang.html#Indexing-by-vectors)
it says:
"Integer. All elements of i must have the same sign. If they are
positive, the elements of x with those index numbers are selected. If
i contains negative elements, all elements except those indicated are
selected.
If i is