[R] R function use in C returning a list

From: Vumani Dlamini <dvumani_at_hotmail.com>
Date: Fri 24 Feb 2006 - 04:28:34 EST

Dear R users,
Is it possible to use an R function accepting several arguments and returning a list in C code. I notice that in all examples only one variable is returned.
Here is the C part I feel is giving the problems,

	SEXP R_fcall, ans;
	PROTECT(R_fcall = lang2(likelihood, R_NilValue));

defineVar(install("PAR"), PAR, env); defineVar(install("DATA"), oldData, env); defineVar(install("N"), N, env); PROTECT(ans = eval(R_fcall, env));

oldData is a matrix which i set using

	SEXP dim;

INTEGER_DATA(dim)[0] = n; INTEGER_DATA(dim)[1] = 2; setAttrib(oldData, R_DimSymbol, dim);

if i return both function and data they are ok, but its evaluating the function and returning the list or even a single number which is a problem. Thanks again, Vumani

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Feb 24 06:30:32 2006

This archive was generated by hypermail 2.1.8 : Fri 24 Feb 2006 - 09:08:58 EST