Can someone lend me a hand with extracting the dimnames from a SEXP?  I've
looked through R-exts, but I couldn't find an example.

Here is the code I'm using to grab the jth column name and print it, but the
colnames I'm getting are garbage.

None of the following are working.

void printInfo(SEXP ts) {

int j;

for (j=0; j<col; j++) {
        printf("%s\n",CHAR(STRING_ELT(GetColNames(ts), j)));
        printf("%s\n",CHAR(VECTOR_ELT(GetColNames(ts), j)));
        printf("%s\n",CHARACTER_DATA(STRING_ELT(GetColNames(ts), j)));
        printf("%s\n",CHARACTER_DATA(VECTOR_ELT(GetColNames(ts), j)));
  }

}

Here is the object I'm passing in:
        
        tmp <- matrix(rnorm(100),ncol=5)
        colnames(tmp) <- c("tmp","a","b","c","d")
        rownames(tmp) <- 1:100  
        .Call("printInfo",tmp)

Thanks for your help.

Regards,
Whit

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to