[R] lang2(...) with two and more arguments

2003-11-04 Thread Timur Elzhov
On Tue, Nov 03, 2003 at 17:06:37 +0100, you wrote: REAL(x)[0] = 10; REAL(y)[0] = 20; SETCADR(R_fcall, x); SETCADR(R_fcall, y); ... .Call(f, c, new.env()) returns `.Primitive(c)(20)' Hmmm. This is definitely not right: SETCADR(R_fcall, x);

Re: [R] lang2(...) with two and more arguments

2003-11-04 Thread Douglas Bates
Timur Elzhov [EMAIL PROTECTED] writes: On Tue, Nov 03, 2003 at 17:06:37 +0100, you wrote: REAL(x)[0] = 10; REAL(y)[0] = 20; SETCADR(R_fcall, x); SETCADR(R_fcall, y); ... .Call(f, c, new.env()) returns `.Primitive(c)(20)' Hmmm. This is definitely not

[R] lang2(...) with two and more arguments

2003-11-03 Thread Timur Elzhov
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));

Re: [R] lang2(...) with two and more arguments

2003-11-03 Thread Prof Brian Ripley
You set the first argument to x and then to y. Why are you surprised? On Mon, 3 Nov 2003, [koi8-r] Timur Elzhov[koi8-r] wrote: 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,

Re: [R] lang2(...) with two and more arguments

2003-11-03 Thread Peter Dalgaard
Timur Elzhov [EMAIL PROTECTED] writes: 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,