I am trying to pass a character vector from R to C and refer to it with the character C. However, I do not know which type conversion macro to use. Below is a small test illustrating my problem.
File test.c:
#include <Rinternals.h> SEXP test(SEXP chars) { char *s; s = CHAR(chars); return R_NilValue; }
File test.R:
dyn.load("test.so") chars <- c("A", "B") .Call("test", chars)
Exit R:
> source("test.R") Error in eval(expr, envir, enclos) : CHAR() can only be applied to a 'CHARSXP', not a 'character'
Any clues?
source share