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

2011-10-13 Thread William Dunlap
g > Subject: Re: [R] pass an element in a list() from R to C > > so, I did this: > > B= list("a" = 1, "b" = 2, "c" = 3) > > .C("myfunction", B) > > > the c code is : > > SEXP myfunction(SEXP matrix_temp) > { >

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