Re: [R] pass an element in a list() from R to C

2011-10-12 Thread teazrq
so, I did this: B= list("a" = 1, "b" = 2, "c" = 3) .C("myfunction", B) the c code is : SEXP myfunction(SEXP matrix_temp) { Rprintf("this element is %6.3f", REAL(VECTOR_ELT(matrix_temp,1))[0]); } but after runing the R code, it says Error: VECTOR_ELT() can only be applied to a 'list', not

[R] pass an element in a list() from R to C

2011-10-12 Thread teazrq
Hi all, I'm new to this "call C from R" so bear with me. I'v been writing some C code and compile it to .dll files that can be called from R. It was successful until today, when I start a new part of this project. So, my R code passes arguments to this C code, and these arguments including some in