12/29/2023 0 Comments Rstudio ifelse![]() I moved them from IRanges to S4Vectors when I did the IRanges/S4Vectors split. These methods were added a long time ago when Rle objects were implemented in IRanges. If this is too much of an annoyance we could also get rid of the ifelse methods for Rle objects defined in S4Vectors: > showMethods("ifelse") See this recommendation from Martin Maechler: ![]() One workaround is for you to use if else instead. ‘yes’ will be evaluated if and only if any element of ‘test’ is true, and analogously for ‘no’. I understand this changes a little bit the contract of the ifelse() function. As a result, the arguments passed to it get evaluated before dispatch can happen, like for any generic function. Loaded via a namespace (and not attached):Īll S4Vectors is doing is turning ifelse() into a generic function with dispatch on its 3 arguments. parallel stats4 stats graphics grDevices utils datasets LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C ![]() LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 This means that even though the 'test' in the ifelse is FALSE, the yes argument is evaluated. The second call to testFnc, after loading S4Vectors, produces the following output:Įrror in ifelse(is.null(universalColors), colors, "grey") :Įrror in evaluating the argument 'yes' in selecting a method for function 'ifelse': Error: argument "colors" is missing, with no default The first call to testFnc produces the expected result: MEs1 = testFnc(expr1, universalColors = labels1) Grey = ifelse(is.null(universalColors), colors, "grey")) TestFnc = function(exprData, colors, universalColors = NULL, Here's the example code (maybe not the simplest, but hopefully simple enough): which seems to break the ifelse function. I stumbled upon a weirdness caused by loading of package S4Vectors.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |