similar to: Shouldn't vector indexing with negative out-of-range index give an error?

Displaying 20 results from an estimated 40000 matches similar to: "Shouldn't vector indexing with negative out-of-range index give an error?"

2015 May 06
1
Shouldn't vector indexing with negative out-of-range index give an error?
On Wed, May 6, 2015 at 1:33 AM, Martin Maechler <maechler at lynne.stat.math.ethz.ch> wrote: >>>>>> John Chambers <jmc at stat.stanford.edu> >>>>>> on Tue, 5 May 2015 08:39:46 -0700 writes: > > > When someone suggests that we "might have had a reason" for some peculiarity in the original S, my usual reaction is "Or
2015 May 06
0
Shouldn't vector indexing with negative out-of-range index give an error?
>>>>> John Chambers <jmc at stat.stanford.edu> >>>>> on Tue, 5 May 2015 08:39:46 -0700 writes: > When someone suggests that we "might have had a reason" for some peculiarity in the original S, my usual reaction is "Or else we never thought of the problem". > In this case, however, there is a relevant statement in the 1988
2015 May 05
0
Shouldn't vector indexing with negative out-of-range index give an error?
>>>>> Henrik Bengtsson <henrik.bengtsson at ucsf.edu> >>>>> on Mon, 4 May 2015 12:20:44 -0700 writes: > 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
2015 May 09
2
R Language Definition: Subsetting matrices with negative indices is *not* an error
On Sat, May 9, 2015 at 12:55 AM, peter dalgaard <pdalgd at gmail.com> wrote: > >> On 09 May 2015, at 02:53 , Henrik Bengtsson <henrik.bengtsson at ucsf.edu> wrote: >> >> Hi, >> >> I spotted what looks like another(*) mistake in 'R Language >> Definition' on how subsetting should work. In Section 'Indexing >> matrices and
2015 May 09
2
R Language Definition: Subsetting matrices with negative indices is *not* an error
Hi, I spotted what looks like another(*) mistake in 'R Language Definition' on how subsetting should work. In Section 'Indexing matrices and arrays' [http://cran.r-project.org/doc/manuals/r-release/R-lang.html#Indexing-matrices-and-arrays] one can read "Negative indices are not allowed in indexing matrices." but this is not true, e.g. > x <- matrix(1:12,
2008 May 02
2
Out of bounds negative index
Hi, From the R Language Definition, Section 3.4.1: "If i is positive and exceeds length(x) then the corresponding selection is NA. A negative out of bounds value for i causes an error." (This is also mentioned in S Programming, footnote of page 24.) Can someone please provide an example triggering the error? Looking in src/main/subscript.c I could not find exception handling for
2015 Sep 20
2
Long vectors: Missing values and R_xlen_t?
Is there a missing value constant defined for R_xlen_t, cf. NA_INTEGER (== R_NaInt == INT_MIN) for int(eger)? If not, is it correct to assume that missing values should be taken care/tested for before coercing from int or double? Thank you, Henrik
2019 Jun 27
2
methods package: A _R_CHECK_LENGTH_1_LOGIC2_=true error
Henrik, If a minimal reprex is hard to construct, could you perhaps instrument your version of R to include a browser() call at the start of the else if(!all(signature[omittedSig] == "missing")) { branch, run the code that triggers the issue for you (and must hit that branch) and tell us what the "signature" and "omittedSig" objects look like at that point?
2019 Jun 25
3
methods package: A _R_CHECK_LENGTH_1_LOGIC2_=true error
**Maybe this bug needs to be understood further before applying the patch because patch is most likely also wrong** Because, from just looking at the expressions, I think neither the R 3.6.0 version: omittedSig <- omittedSig && (signature[omittedSig] != "missing") nor the patched version (I proposed): omittedSig <- omittedSig & (signature[omittedSig] !=
2015 May 13
1
Why is the diag function so slow (for extraction)?
As kindly pointed out to me (oh my decaying gray matter), is.object() is better suited for this test; $ svn diff src/library/base/R/diag.R Index: src/library/base/R/diag.R =================================================================== --- src/library/base/R/diag.R (revision 68345) +++ src/library/base/R/diag.R (working copy) @@ -23,9 +23,11 @@ stop("'nrow' or
2015 May 12
2
Why is the diag function so slow (for extraction)?
>>>>> Steve Bronder <sbronder at stevebronder.com> >>>>> on Thu, 7 May 2015 11:49:49 -0400 writes: > Is it possible to replace c() with .subset()? It would be possible, but I think "entirely" wrong. .subset() is documented to be an internal function not to be used "lightly" and more to the point it is documented to *NOT*
2006 Mar 15
1
setMethod confusion -best reference for S4 programming
Thanks I think you have both answered my question (reckon Ill go S3 on that). As an adjunct to this do you know what might be the best reference to the S4 methods current implementation. I have ordered the Chambers book "Programming with Data", and I have a short tutorial-- "S4 Classes in 15 pages, more or less". Have I missed any other useful resources? Stephen Henderson
2018 Aug 05
2
Is this a bug in `[`?
El dom., 5 ago. 2018 a las 6:27, Kenny Bell (<kmbell56 at gmail.com>) escribi?: > > This should more clearly illustrate the issue: > > c(1, 2, 3, 4)[-seq_len(4)] > #> numeric(0) > c(1, 2, 3, 4)[-seq_len(3)] > #> [1] 4 > c(1, 2, 3, 4)[-seq_len(2)] > #> [1] 3 4 > c(1, 2, 3, 4)[-seq_len(1)] > #> [1] 2 3 4 > c(1, 2, 3, 4)[-seq_len(0)] > #>
2017 Mar 03
2
Control statements with condition with greater than one should give error (not just warning) [PATCH]
On Fri, Mar 3, 2017 at 9:55 AM, Hadley Wickham <h.wickham at gmail.com> wrote: >> But, how you propose a warning-to-error transition should be made >> without wreaking havoc? Just flip the switch in R-devel and see CRAN >> and Bioconductor packages break overnight? Particularly Bioconductor >> devel might become non-functional (since at times it requires >>
2002 Oct 13
1
The class attribute on an environment seems buggy (PR#2159)
Full_Name: Henrik Bengtsson Version: 1.6.0, 1.5.1 OS: WinXP Pro Submission from: (NULL) (128.250.252.82) The following example, which I tested on both R v1.5.1 and R v1.6.0 on WinXP Pro, shows the problem I encountered when trying to use the class attribute of an environment: # Define method print() for class Environment C print(e) # gives: # [1] "An Environment!" # Exit [R]
2005 Apr 15
1
treatment of zero and negative elements in matrix indices
Matrix indexing seems to give rather "variable" results when zeros or negative values are included among the indices (in terms of both error messages and in terms of the number of returned values when there is no error message). Is this the intended behavior? I couldn't see any comments about zeros or negative values in matrix indices in either ?"[" or Section 3.4.2
2002 Jan 06
1
How to get setGeneric() to work?
Dear all, I can't see how setGeneric() works. I know perfectly well how to define library(methods); setClass("Square", representation(side="numeric")); # Will become the default method. getArea <- function(object) { stop(paste("Method getArea() is not defined for this class:", data.class(object))); } setMethod("getArea",
2017 Mar 04
3
Control statements with condition with greater than one should give error (not just warning) [PATCH]
Is there really a need for these complications? Packages emitting this warning are broken by definition and should be fixed. Perhaps we could "flip the switch" in a test environment and see how much havoc is wreaked and whether authors are sufficiently responsive? Michael On Sat, Mar 4, 2017 at 12:04 PM, Martin Maechler <maechler at stat.math.ethz.ch > wrote: >
2017 Mar 03
2
Control statements with condition with greater than one should give error (not just warning) [PATCH]
I'd like to propose that the whenever the length of condition passed to an if or a while statement differs from one, an error is produced rather than just a warning as today: > x <- 1:2 > if (x == 1) message("x == 1") x == 1 Warning message: In if (x == 1) message("x == 1") : the condition has length > 1 and only the first element will be used There are
2018 Aug 29
7
ROBUSTNESS: x || y and x && y to give warning/error if length(x) != 1 or length(y) != 1
# Issue 'x || y' performs 'x[1] || y' for length(x) > 1. For instance (here using R 3.5.1), > c(TRUE, TRUE) || FALSE [1] TRUE > c(TRUE, FALSE) || FALSE [1] TRUE > c(TRUE, NA) || FALSE [1] TRUE > c(FALSE, TRUE) || FALSE [1] FALSE This property is symmetric in LHS and RHS (i.e. 'y || x' behaves the same) and it also applies to 'x && y'.