search for: narg

Displaying 20 results from an estimated 144 matches for "narg".

Did you mean: arg
2013 Dec 05
0
S4 method for '[' with extra arguments: distinguishing between x[i] and x[i, ]
Hi, I want to implement a '[' for an S4 class, that behaves differently when called with a single index argument or multiple indexes (possibly missing), like what happens when subsetting matrices x[i] vs. x[i, ]. I manage to do it using nargs() and checking if drop is missing (see code below), but when I want to add an extra argument to the method (before drop), then the parent call somehow changes and always includes all indexes in the call (even missing ones) and nargs() always returns the same value. I thought there might be a gene...
2012 Mar 21
1
enableJIT() and internal R completions (was: [ESS-bugs] ess-mode 12.03; ess hangs emacs)
Hello, JIT compiler interferes with internal R completions: compiler::enableJIT(2) utils:::functionArgs("density", '') gives: utils:::functionArgs("density", '') Note: no visible global function definition for 'bw.nrd0' Note: no visible global function definition for 'bw.nrd' Note: no visible global function definition for 'bw.ucv' Not...
2007 Jan 28
0
"[", .local and S4 methods (was: "[" operator and indexing ambiguity)
Dear Tony, thanks for the tip with "nargs", when suitably applied, this answers the problem. The behaviour of "nargs" in S4 methods has some subtleties compared to that in normal functions, as shown in the example below. I admit that this is what had earlier created some confusion about the semantics of "nargs&quo...
2000 Jun 26
2
nargs() inside "[.myclass"
I am writing a function to work with class I am defining. I have a question about using nargs() inside of parentheses function. nargs() shows the same for supplying 1 argument, or no arguments at all. Here is a small example: > "[.myclass"<-function(x,...) print(nargs()-1) > x<-c(1,2,3) > class(x)<-"myclass" > x[] [1] 1 > x[1] [1] 1 > x[1,2...
2002 Jun 12
3
help debugging segfaults
...was able to finish growing the 7000 trees, but segfault when returning from rf() to R. GDB gave the following (gdb prompts removed): do_dotCode (call=0x873aff4, op=0x8a5f620, args=0x8a5d010, env=0x86fd0a4) at dotcode.c:1413 1413 break; 1845 PROTECT(ans = allocVector(VECSXP, nargs)); 1846 havenames = 0; 1847 if (dup) { 1849 info.cargs = cargs; 1850 info.allArgs = args; 1851 info.nargs = nargs; 1852 info.functionName = buf; 1853 nargs = 0; 1854 for (pargs = args ; pargs != R_NilValue ; pargs = CD...
2002 Jun 12
3
help debugging segfaults
...was able to finish growing the 7000 trees, but segfault when returning from rf() to R. GDB gave the following (gdb prompts removed): do_dotCode (call=0x873aff4, op=0x8a5f620, args=0x8a5d010, env=0x86fd0a4) at dotcode.c:1413 1413 break; 1845 PROTECT(ans = allocVector(VECSXP, nargs)); 1846 havenames = 0; 1847 if (dup) { 1849 info.cargs = cargs; 1850 info.allArgs = args; 1851 info.nargs = nargs; 1852 info.functionName = buf; 1853 nargs = 0; 1854 for (pargs = args ; pargs != R_NilValue ; pargs = CD...
2003 Oct 10
1
number of arguments in .Call function registration
I initially sent this to the biocore mailing list - but it was suggested that r-devel would also find it interesting. Many of us use a macro like #define CALL_DEF(fname, nargs) { #fname, (DL_FUNC)&fname, nargs} for use in function registration for use with .Call. For example, using the example from R Extension manual, if we want to register a C function myCall with three arguments, we will use R_CallMethodDef callMethods[] = { CALL_DEF(myCall, 3), {NULL,...
2009 Mar 18
1
sprintf("%d", integer(0)) aborts
...=============================== --- sprintf.c (revision 48148) +++ sprintf.c (working copy) @@ -79,13 +79,13 @@ static R_StringBuffer outbuff = {NULL, 0, MAXELTSIZE}; Rboolean use_UTF8; - outputString = R_AllocStringBuffer(0, &outbuff); - /* grab the format string */ nargs = length(args); format = CAR(args); - if (!isString(format) || length(format) == 0) + if (!isString(format)) error(_("'fmt' is not a non-empty character vector")); + if (length(format) == 0) + return allocVector(STRSXP, 0) ; args = CDR(args); narg...
2002 Jun 18
1
can't find array overruns (was: help debugging segfaults)
..., but segfault when returning from rf() > to R. GDB > gave the following (gdb prompts removed): > > do_dotCode (call=0x873aff4, op=0x8a5f620, args=0x8a5d010, > env=0x86fd0a4) > at dotcode.c:1413 > 1413 break; > 1845 PROTECT(ans = allocVector(VECSXP, nargs)); > 1846 havenames = 0; > 1847 if (dup) { > 1849 info.cargs = cargs; > 1850 info.allArgs = args; > 1851 info.nargs = nargs; > 1852 info.functionName = buf; > 1853 nargs = 0; > 1854 for (pargs =...
2014 Jan 28
2
[LLVMdev] Weird msan problem
...t though, since if I look at the functions before it, the place where it's coming from is initialized: #4 0x00007f41755208a8 in julia_isempty248 () #5 0x00007f417c163e3d in jl_apply (f=0x606000984d60, f at entry=<optimized out>, args=0x7fff9132da20, args at entry=<optimized out>, nargs=1, nargs at entry=<optimized out>) at ./julia.h:1043 (here's the code of that julia function for reference) isempty(s::IntSet) = !s.fill1s && ccall(:bitvector_any1, Uint32, (Ptr{Uint32}, Uint64, Uint64), s.bits, 0, s.limit)==0 Looking at where that value is coming from...
2011 Jan 25
1
Missing argument vs. empty argument
Hi, is there an easy, robust, and/or recommended way to distinguish a missing argument from an empty argument as in: foo <- function(i, j){ print(missing(j)) print(nargs()) } foo(i) # TRUE, 1 foo(i,) # TRUE, 2 I know I can work around with nargs, the list of arguments and the names of the passed arguments, but I wish there is something already in place for this. This is specially important for '['-like methods where x[i,] is not the same as x[i]. Wha...
2010 May 14
2
Subscripting a matrix-like object
...ries) which may or may not have multiple columns. I have a function "[<-.tis" that I've reproduced below. My question is this: inside of "[<-.tis", how can I distinguish between calls of the form x[i] <- someValue and x[i,] <- someValue ? In either case, nargs() is 3, and looking at the values from sys.call() and match.call() I could not tell them apart. Am I missing something? "[<-.tis" <- function(x, i, j, ..., value){ tif <- tif(x) xStart <- start(x) x <- stripTis(x) if(missing(i)){ if(missing(j)) x[] <- v...
2010 May 14
2
Subscripting a matrix-like object
...ries) which may or may not have multiple columns. I have a function "[<-.tis" that I've reproduced below. My question is this: inside of "[<-.tis", how can I distinguish between calls of the form x[i] <- someValue and x[i,] <- someValue ? In either case, nargs() is 3, and looking at the values from sys.call() and match.call() I could not tell them apart. Am I missing something? "[<-.tis" <- function(x, i, j, ..., value){ tif <- tif(x) xStart <- start(x) x <- stripTis(x) if(missing(i)){ if(missing(j)) x[] <- v...
2014 Jan 28
2
[LLVMdev] Weird msan problem
...nctions before it, the place where it's coming from is initialized: >> >> #4 0x00007f41755208a8 in julia_isempty248 () >> #5 0x00007f417c163e3d in jl_apply (f=0x606000984d60, f at entry=<optimized >> out>, args=0x7fff9132da20, args at entry=<optimized out>, nargs=1, >> nargs at entry=<optimized out>) at ./julia.h:1043 >> >> (here's the code of that julia function for reference) >> >> isempty(s::IntSet) = >> !s.fill1s && ccall(:bitvector_any1, Uint32, (Ptr{Uint32}, Uint64, >> Uint64), s.bit...
2014 Feb 01
2
[LLVMdev] Weird msan problem
...ming from is initialized: >> >> >> >> #4 0x00007f41755208a8 in julia_isempty248 () >> >> #5 0x00007f417c163e3d in jl_apply (f=0x606000984d60, f at entry >> =<optimized >> >> out>, args=0x7fff9132da20, args at entry=<optimized out>, nargs=1, >> >> nargs at entry=<optimized out>) at ./julia.h:1043 >> >> >> >> (here's the code of that julia function for reference) >> >> >> >> isempty(s::IntSet) = >> >> !s.fill1s && ccall(:bitvector_any1,...
2017 May 18
2
stopifnot() does not stop at first non-TRUE argument
>From an example in http://www.uni-muenster.de/ZIV.BennoSueselbeck/s-html/helpfiles/nargs.html , number of arguments in '...' can be obtained by (function(...)nargs())(...) . I now realize that sys.call() doesn't expand '...' when the function is called with '...'. It just returns the call as is. If 'stopifnot' uses sys.call() instead of match.call(...
2009 Jun 25
2
stringsAsFactors has no impact in expand.grid()?
Hi I have the feeling, that the argument stringsAsFactors has no impact in the function expand.grid: a <- c("PR", "NC", "A2", "BS") b <- c(1, 0.5, 0.25, 0.125, 0.0625, 0.03125) class(expand.grid(css, fscs, stringsAsFactors=FALSE)[[1]]) [1] "factor" class(expand.grid(css, fscs, stringsAsFactors=TRUE)[[1]]) [1] "factor" Also, when
2012 Dec 27
0
Suggestion: 'method' slot for expand.grid() (incl. diffs)
...unction(..., KEEP.OUT.ATTRS = TRUE, stringsAsFactors = TRUE) +expand.grid <- function(..., KEEP.OUT.ATTRS = TRUE, stringsAsFactors = TRUE, + method = c("decreasing", "increasing")) { ## x should either be a list or a set of vectors or factors nargs <- length(args <- list(...)) @@ -26,7 +27,9 @@ if(nargs == 0L) return(as.data.frame(list())) ## avoid classed args such as data frames: cargs <- args cargs <- vector("list", nargs) - iArgs <- seq_len(nargs) + seqArgs <- seq_len(nargs) + method &l...
2014 Feb 02
2
[LLVMdev] Weird msan problem
...gt; >>>> >> #4 0x00007f41755208a8 in julia_isempty248 () >>>> >> #5 0x00007f417c163e3d in jl_apply (f=0x606000984d60, >>>> >> f at entry=<optimized >>>> >> out>, args=0x7fff9132da20, args at entry=<optimized out>, nargs=1, >>>> >> nargs at entry=<optimized out>) at ./julia.h:1043 >>>> >> >>>> >> (here's the code of that julia function for reference) >>>> >> >>>> >> isempty(s::IntSet) = >>>> >>...
2018 May 06
0
length of `...`
Does anyone notice r-devel thread "stopifnot() does not stop at first non-TRUE argument" starting with https://stat.ethz.ch/pipermail/r-devel/2017-May/074179.html ? I have mentioned (function(...)nargs())(...) in https://stat.ethz.ch/pipermail/r-devel/2017-May/074294.html . Something like ..elt(n) is switch(n, ...) . I have mentioned it in https://stat.ethz.ch/pipermail/r-devel/2017-May/074270.html . See also response in https://stat.ethz.ch/pipermail/r-devel/2017-May/074282.html . By the way,...