similar to: Usage of PROTECT_WITH_INDEX in R-exts

Displaying 20 results from an estimated 1000 matches similar to: "Usage of PROTECT_WITH_INDEX in R-exts"

2017 Jun 06
2
Usage of PROTECT_WITH_INDEX in R-exts
On 06.06.2017 10:07, Martin Maechler wrote: >>>>>> Kirill M?ller <kirill.mueller at ivt.baug.ethz.ch> >>>>>> on Mon, 5 Jun 2017 17:30:20 +0200 writes: > > Hi I've noted a minor inconsistency in the documentation: > > Current R-exts reads > > > s = PROTECT_WITH_INDEX(eval(OS->R_fcall, OS->R_env), &ipx);
2017 Jun 09
1
Usage of PROTECT_WITH_INDEX in R-exts
>>>>> Kirill M?ller <kirill.mueller at ivt.baug.ethz.ch> >>>>> on Thu, 8 Jun 2017 12:55:26 +0200 writes: > On 06.06.2017 22:14, Kirill M?ller wrote: >> >> >> On 06.06.2017 10:07, Martin Maechler wrote: >>>>>>>> Kirill M?ller <kirill.mueller at ivt.baug.ethz.ch> on
2017 Jun 08
0
Usage of PROTECT_WITH_INDEX in R-exts
On 06.06.2017 22:14, Kirill M?ller wrote: > > > On 06.06.2017 10:07, Martin Maechler wrote: >>>>>>> Kirill M?ller <kirill.mueller at ivt.baug.ethz.ch> >>>>>>> on Mon, 5 Jun 2017 17:30:20 +0200 writes: >> > Hi I've noted a minor inconsistency in the documentation: >> > Current R-exts reads >>
2017 Jun 06
0
Usage of PROTECT_WITH_INDEX in R-exts
>>>>> Kirill M?ller <kirill.mueller at ivt.baug.ethz.ch> >>>>> on Mon, 5 Jun 2017 17:30:20 +0200 writes: > Hi I've noted a minor inconsistency in the documentation: > Current R-exts reads > s = PROTECT_WITH_INDEX(eval(OS->R_fcall, OS->R_env), &ipx); > but I believe it has to be > PROTECT_WITH_INDEX(s =
2008 Mar 07
1
parameters for lbfgsb (function for optimization)
Can anyone help me with lbfgsb (function for optimization)? It takes the following parameters: void lbfgsb (int n, int lmm, double *x, double *lower, double *upper, int *nbd, double *Fmin, optimfn fn, optimgr gr, int *fail, void *ex, double factr, double pgtol, int *fncount, int *grcount, int maxit, char *msg, int trace, int nREPORT); What do I put for parameter ex (11th parameter)? I looked at
2003 Oct 31
2
How to grow an R object from C (.Call Interface)
What is the best way to grow an R return object in writing a C function using the Rdefines.h macros. In my application, the final size of the return object is not known during construction. My understanding is that each time I grow an R object I have to use PROTECT() again, probably before UNPROTECTing the smaller version. However, due to the stack character of the PROTECT mechanism, UNPROTECT
2014 Aug 13
1
Request to review a patch for rpart
Dear list For my work, it would be helpful if rpart worked seamlessly with an empty model: library(rpart); rpart(formula=y~0, data=data.frame(y=factor(1:10))) Currently, an unrelated error (originating from na.rpart) is thrown. At some point in the near future, I'd like to release a package to CRAN which uses rpart and relies on that functionality. I have prepared a patch (minor
2014 Feb 11
2
$new cannot be accessed when running from Rscript and methods package is not loaded
Hi Accesses the $new method for a class defined in a package fails if the methods package is not loaded. I have created a test package with the following single code file: newTest <- function() { cl <- get("someClass") cl$new } someClass <- setRefClass("someClass") (This is similar to code actually used in the testthat package.) If methods is not loaded,
2013 Nov 05
1
Dynamic list creation (SEXP in C) returns error "unimplemented type (29) in 'duplicate'"
Dear R-devel, A couple of weeks ago I started to use the R C API for package development. Without knowing much about C, I've been able to write some routines sucessfully... until now. My problem consists in dynamically creating a list ("L1") of lists using .Call, the tricky part is that each element of the "mother list" contains two vectors (INTSXP and REALEXP types) with
2010 Aug 23
1
Speed improvement to PROTECT, UNPROTECT, etc.
As I mentioned in my previous message about speeding up evalList, I've been looking at ways to speed up the R interpreter. One sees in the code many, many calls of PROTECT, UNPROTECT, and related functions, so that seems like an obvious target for optimization. Indeed, I've found that one can speed up the interpreter by about 10% by just changing these. The functions are actually macros
2003 Nov 03
2
lang2(...) with two and more arguments
Dear R-help, how could I create an R call in C code using lang2 with 2 and more arguments? I tried this code: SEXP f(SEXP fn, SEXP rho) { SEXP R_fcall, x, y; PROTECT(R_fcall = lang2(fn, R_NilValue)); PROTECT(x = allocVector(REALSXP, 1)); PROTECT(y = allocVector(REALSXP, 1)); REAL(x)[0] = 10; REAL(y)[0] = 20; SETCADR(R_fcall, x); SETCADR(R_fcall, y);
2015 Feb 09
3
xtabs and NA
Hi I haven't found a way to produce a tabulation from factor data with NA values using xtabs. Please find a minimal example below, it's also on R-pubs [1]. Tested with R 3.1.2 and R-devel r67720. It doesn't seem to be documented explicitly that it's not supported. From reading the code [2] it looks like the relevant call to table() doesn't set the "useNA"
2008 Apr 24
1
Calling R functions with multiple arguments from C
Hi, I'm writing a C function that has to call a R function with multiple arguments. I've read the relevant section in Writing R Extensions, and searched the R site, mailing lists as well as rseek. I managed to call the function, but I'm now having trouble creating the argument list. I tried to create a pairlist of the arguments and send it to the R function. The R function however
2007 Apr 13
1
Simulated annealing using optim()
I'm preparing some code to compute the optimal geometry of stressed solids. The core of the calculations is the optimization of elastic energy using the simulated annealing method implemented in the R optim() rutine. I've defined a function to compute this "energy" scalar (the fn parameter for optim) and prepared a list with the arrays defining the geometry and the elastic
2016 May 09
2
R process killed when allocating too large matrix (Mac OS X)
On 05/05/2016 10:11, Uwe Ligges wrote: > Actually this also happens under Linux and I had my R processes killed > more than once (and much worse also other processes so that we had to > reboot a server, essentially). I found that setting RLIMIT_AS [1] works very well on Linux. But this requires that you cap memory to some fixed value. > library(RAppArmor) > rlimit_as(1e9) >
2003 Dec 12
3
C++: Appending Values onto an R-Vector.
Hi folks. I posted this question a few days ago, but maybe it got lost because of the code I included with it. I'm having a problem using the SET_LENGTH() macro in an R extension I'm writing in C++. In a function within the extension I use SET_LENGTH() to resize R vectors so as to allow the concatenation of single values onto the vectors -- it's a "push back" function to
2009 May 26
1
passing "..." arguments to a function called by eval()
Hi everyone, I am starting learn to call C code from within R. So far, I've been trying toy problems to see if I can get them to work. One of the things I'd like to do is pass an arbitrary R function to C, evaluate the value in the C code using eval, and then return it. I also want to allow an arbitrary number of arguments to the function using "...". The code for my toy
2016 Mar 10
2
getParseData() for installed packages
I can't seem to reliably obtain parse data via getParseData() for functions from installed packages. The parse data seems to be available only for the *last* file in the package. See [1] for a small example package with just two functions f and g in two files a.R and b.R. See [2] for a documented test run on installed package (Ubuntu 15.10, UTF-8 locale, R 3.2.3). Same behavior with
2016 Dec 16
2
Upgrading a package to which other packages are LinkingTo
Hi I'd like to suggest to make R more informative when a user updates a package A where there's at least one package B that has "LinkingTo: A" in its description. To illustrate the problem, assume package A is updated so that its C/C++ header interface (in inst/include) is changed. For package B to pick up these changes, we need to reinstall package A. In extreme cases, if
2003 Jan 16
1
Calling R function from within C code
Dear R experts, I'd like to call R function from within C code. I looked through the 'R exts' manual, found examples with lang2(R_fcall, list), and tried it, but it seemed to create the call, which can accept only a single argument of 'list' type, when I need to create the call of R functions with arbitrary numbers of arguments. How can I do it? Thanks a lot. -- WBR,