similar to: Calling R functions with multiple arguments from C

Displaying 20 results from an estimated 200 matches similar to: "Calling R functions with multiple arguments from C"

2008 Jul 22
4
Opening files from R terminal - appologies
Dear all, I appologise for cluttering up the list with such a basic question, however I have been unable to find the answer I want (possibly through my poor usage of the R help system). As I am visually impaired and using assistive technology, I think I would prefer to use R from the terminal mode, i.e. by running rterm.exe found in the bin directory. I have managed to set my working
2011 Aug 04
2
Graphical option to update.packages in development version (build of the 2011-07-31 r56569) for Windows not working properly
Dear R-core/development-team, The problem noted in the subject-line has been a problem in the last three development versions of R for Windows that I have downloaded and tested, the most recent of them being a version I downloaded this morning. Update.packages() using the graphical option, i.e. called as update.packages(ask='graphics', checkBuilt=TRUE) does not work as it should, but
2011 Feb 07
1
how to return multipy matrix in a function
Hello I have a 100*100 matrix which is from a intensive computation, e.g. mat. Is there any method/function that return the max of every row and the subscript of maximum value simultaneously #define the function > returnfunction<-function(x){ + value<-apply(x,1,max) + index<-apply(x,1,which.max) + } > mat<-matrix(c(3,5,7,2,1,10,4,3,2),3)#initilize the matrix for test >
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);
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
2011 Feb 07
1
kernel density
Hi all (again), many thanks for the answer to the optimization problem. All is fine now. The problem now is with kernel estimators in sm. package. I do all the work and the graphics good, but I need the density function data for each point, and I don't know how to get it. The only thing I get is the table at the end of the following sequence: >
2017 Jun 05
2
Usage of PROTECT_WITH_INDEX in R-exts
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 = eval(OS->R_fcall, OS->R_env), &ipx); because PROTECT_WITH_INDEX() returns void. Best regards Kirill
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
2011 Nov 05
0
ANESRAKE package: Inappropriate error message, given the data
Hi, Attempting to use the "anesrake" raking (also referred to as rim weighting) package to weight survey data (Note: DATA is listed at the bottom along with SESSION INFO AND COMMANDS ARGUMENTS USED to allow you to reproduce the error). Presents following error message: *"Error in selecthighestpcts(discrep1, inputter, pctlim) : * * No variables are off by more than 5 percent using
2009 Feb 09
2
cwhmisc package requests update all the time!
Dear Christian, Every single time check update package, ?cwhmisc? always requests updating. I?m aware that the package was latest updated in CRAN on 20Nov2008. Is there anything wrong with my R library or somethingelse? I use R 2.8.1 on Window XP service pack 2 Regards Nguyen Garvan Institute of Medical Research Sydney, Australia
2011 Aug 17
3
getNativeSymbolInfo("user_unif_rand") returns different results on windows and linux
Hi, When loading a package that provides the user-supplied RNG hook user_unif_rand, calling getNativeSymbolInfo("user_unif_rand") returns informations about the loaded symbol. I am using this to identify which package currently provides the RNG hook. The results are the same on windows and linux if only one library provides the hook. If one loads a second package that provides this
2009 Jun 26
1
The Claw Density and LOCFIT
I am trying to reproduce Figure 10.5 of Loader's book: Local Regression and Likelihood. The code provided in the book does not seem to work. I have managed (a while ago) to get the accompanied R-code for the figures in the book (file called lffigs.R) from somewhere - cannot find it on the web anymore. The code in the .R script file does not work either. Could anybody please direct me in
2006 Nov 28
2
Problem with pairs() in nlme
Dear r-helpers, After successfully running require(nlme) vfr.lmL <- lmList( estimate ~ (slant + respType + visField + hand)^2 | subject, vfr ) pairs(vfr.lmL, id = 0.01, adj = -0.5) # Pinheiro & Bates (p. 141) produces the following error: Error in sprintf(gettext(fmt, domain = domain), ...) : object "form" not found Any guesses as to what I may have done wrong?
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,
2009 Sep 15
1
How can I use R:sort function in C code?
Hi, I wrote a C extension for R. Within the C code I wanted to invoke the R's sort function, with the argument "index.return = TRUE". I found it is a difficult problem, how can I do that? I have implemented the decreasing sorting by the code "PROTECT(R_fcall = lang3(install("sort"), x, desc));", but how to define the "index.return" argument? Thanks in
2014 Apr 03
1
question regarding lang2 command in C
Hi , I am asking too many questions , sorry for that . I am creating a data frame in C itself , reading a table . The data frame calling code looks like this ====================================== *PROTECT(dfm=lang2(install("data.frame"),df));* *SEXP res = PROTECT(eval(dfm,R_GlobalEnv));* UNPROTECT(2); return res; ================================== It works fine , now the problem
2007 Dec 12
3
lm/model.matrix confusion (? bug)
Dear List-members, Hopefully someone will help through my confusion: In order to get the same coefficients as we get from the following ## require (MASS) summary ( lm(Gas ~ Insul/Temp - 1, data = whiteside) ) ...................... we need to do the following (if we use model.matrix to specify the model) ## summary ( lm(Gas ~ model.matrix(~ Insul/Temp - 1) - 1, data = whiteside) )
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
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