similar to: sum(), min(), max(), prod() vs. named arguments in ...

Displaying 20 results from an estimated 1000 matches similar to: "sum(), min(), max(), prod() vs. named arguments in ..."

2023 Apr 14
0
sum(), min(), max(), prod() vs. named arguments in ...
Hello R-devel, As mentioned on Fosstodon [1] and discussed during RCOH [2], named arguments to sum(), min(), max() and prod() are currently processed the same way as the un-named ones. Additionally, when specifying the na.rm argument more than once, the last specified value is silently taken into account. Most of this behaviour is exactly as documented, but it's arguably a source of mistakes
2010 Aug 21
1
Speed improvement to evalList
I've been inspired to look at the R source code by some strange timing results that I wrote about on my blog at radfordneal.wordpress.com (see the posts on "Speeding up parentheses..." and "Two surprising things...". I discovered that the strange speed advantage of curly brackets over parentheses is partially explained by an inefficiency in the evalList and
2020 May 22
0
round() and signif() do not check argument names when a single argument is given
Hi, I was told to send this to the -devel list instead of posting to bugzilla. When round our signif are called with a single named argument, R does not check the name and runs the function with that named argument directly as the first argument, using 0.0 or 6.0 (6 in the case of signif) for the second argument. Not checking the argument name is at odds with how all other primitive functions
2020 Jun 30
0
Build a R call at C level
Thanks Jan and Tomas for the feedback. Answer from Jan is what I am looking for. Maybe I am not looking in the right place buy it is not easy to understand how these LCONS, CONS, SETCDR...etc works. Thank you Best regards Morgan On Tue, 30 Jun 2020, 12:36 Tomas Kalibera, <tomas.kalibera at gmail.com> wrote: > On 6/30/20 1:06 PM, Jan Gorecki wrote: > > It is quite known that R
2020 Jun 30
3
Build a R call at C level
On 6/30/20 1:06 PM, Jan Gorecki wrote: > It is quite known that R documentation on R C api could be improved... Please see "5.11 Evaluating R expressions from C" from "Writing R Extensions" Best Tomas > Still R-package-devel mailing list should be preferred for this kind > of questions. > Not sure if that is the best way, but works. > > call_to_sum <-
2020 Jun 30
0
Build a R call at C level
It is quite known that R documentation on R C api could be improved... Still R-package-devel mailing list should be preferred for this kind of questions. Not sure if that is the best way, but works. call_to_sum <- inline::cfunction( language = "C", sig = c(x = "SEXP"), body = " SEXP e = PROTECT(lang2(install(\"sum\"), x)); SEXP r_true =
2006 Sep 08
1
R drop behavior -- set as option in later version?
Hi, I know the topic of drop=TRUE/FALSE has been discussed quite a bit, but I was wondering whether it might be possible to set "drop=FALSE" as a global setting (e.g. as an option in options()) so that one does not have to remember to write it every time you do an operation which might return a 1 column or 1 row matrix. I searched in R-help and did not see any previous proposals along
2006 Sep 08
1
R drop behavior -- set as option in later version?
Hi, I know the topic of drop=TRUE/FALSE has been discussed quite a bit, but I was wondering whether it might be possible to set "drop=FALSE" as a global setting (e.g. as an option in options()) so that one does not have to remember to write it every time you do an operation which might return a 1 column or 1 row matrix. I searched in R-help and did not see any previous proposals along
2013 May 21
1
making makepredictcall() work
Dear All, I'm interested in creating a function similar to ns() from package splines that can be passed in a model formula. The idea is to produce "safe" predictions from a model using this function. As I have seen, to do this I need to use makepredictcall(). Consider the following toy example: myns <- function (x, df = NULL, knots = NULL, intercept = FALSE, Boundary.knots =
2014 Nov 23
0
[PATCH 2/3] New API: guestfs_blockdev_setra: Adjust readahead for filesystems and devices.
This adds a binding for 'blockdev --setra', allowing you to adjust the readahead parameter for filesystems and devices. --- daemon/blockdev.c | 30 ++++++++++++++++++++---------- generator/actions.ml | 14 ++++++++++++++ 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/daemon/blockdev.c b/daemon/blockdev.c index 8a7b1a8..6e8821d 100644 --- a/daemon/blockdev.c +++
2020 Sep 11
4
Garbage collection of seemingly PROTECTed pairlist
I want to write an R function using R's C interface that takes a 2-column matrix of increasing, non-overlapping integer intervals and returns a list with those intervals plus some added intervals, such that there are no gaps. For example, it should take the matrix rbind(c(5L, 6L), c(7L, 10L), c(20L, 30L)) and return list(c(5L, 6L), c(7L, 10L), c(11L, 19L), c(20L, 30L)). Because the output is
2020 Sep 12
0
Garbage collection of seemingly PROTECTed pairlist
Hi, In line 5, you are allocating a vector of length nc. Then, in line 12, you are using nr as a limit, so if nr goes beyond nc, which is happening in line 39, you are in trouble. I?aki On Sat, 12 Sep 2020 at 03:30, Rory Nolan <rorynoolan at gmail.com> wrote: > I want to write an R function using R's C interface that takes a 2-column > matrix of increasing, non-overlapping
2010 Sep 08
0
Correction to vec-subset speed patch
I found a bug in one of the fourteen speed patches I posted, namely in patch-vec-subset. I've fixed this (I now see one does need to duplicate index vectors sometimes, though one can avoid it most of the time). I also split this patch in two, since it really has two different and independent parts. The patch-vec-subset patch now has only some straightforward (locally-checkable) speedups for
2009 Nov 18
1
R_NilValue and segfault.
Hello. I've been trying to wrap up the R_NilValue into OCaml-R. I nevertheless get a segfault. As I gathered, R_NilValue is declared in Rinternals.h: > /* Special Values */ > LibExtern SEXP R_NilValue; /* The nil object */ > LibExtern SEXP R_UnboundValue; /* Unbound marker */ > LibExtern SEXP R_MissingArg; /* Missing argument marker */ So, in my r_data.c
2020 Sep 07
0
some questions about R internal SEXP types
Thanks, Gabriel. On Mon, 2020-09-07 at 14:38 -0700, Gabriel Becker wrote: > I cannot speak to initial intent, perhaps others can. I can say that > there is at least one place where the difference between R_NilValue > and NULL is very important as of right now. The current design of the > ALTREP framework contract expects ALTREP methods that return a SEXP > to return C NULL when
2010 Sep 09
0
calling Rf_initEmbeddedR error
Hi all, I have a problem of Rf_initEmbeddedR function. I've tried with: try { int Argc1 = 1; char *Argv1[] = {"Rtest_1"}; int Argc2 = 1; char *Argv2[] = {"Rtest_2"}; // Init R(first) Rf_initEmbeddedR(Argc1, Argv1); // R package load SEXP e = R_NilValue; SEXP r = R_NilValue; PROTECT(e =
2014 Feb 26
1
help with gotoExitingHandler(R_NilValue, call, entry); . Implementation of error handling internally
Hello, I?m trying to leverage R_ToplevelExec to implement C level try/catch. The way it is implemented allows for running a function in a top level context. This context gets an empty handler stack, so either the function runs correctly or it jumps. When it jumps, it does not find a handler, so it jumps to the top level context. R does not allow me to call begin context and end context
2009 Dec 10
1
switch() called with just the EXPR argument causes R to hang (PR#14124)
Dear all, switch() called with just the EXPR argument causes R to hang so that the only way to stop it is to kill R. Reproducible example: > switch(EXPR="a") the internal C subroutine behind switch is do_switch located in R/src/main/builtin.c For convenience I reproduce it below. ***************************************************************************** SEXP attribute_hidden
2005 Apr 18
3
A 'true' R-wrapper for C++ classes
Hello I am trying to wrap some C++ classes into R. (1) Comparing the OOP and methods packages, I have came to this conclusion that OOP works much better for this wrapper -- please correct me if I am wrong. One question is why this useful package (OOP) is not included in the official release of R? (2) Choosing the OOP package way, I have carried out the following steps to wrap the C++
2008 Apr 06
0
manual 'Writing R Extensions': bug in example
Hi, I would like to report a small bug in one of the code examples given in the 'Writing R extensions' manual. Section 5.9.2 ("Calling .External") defines the function "showArgs" in order to demonstrate how to access in C the pair-listed arguments passed by .External. The function aims at printing echoing all passed arguments to the screen but only prints every