That was the correct direction: I changed the earler line to "routines <- list(Ccoxfit5a, ..." and the the later to .C(routnines[[1]]) and now it works as desired.

Terry T.

On 02/23/2013 03:09 AM, Duncan Murdoch wrote:
On 13-02-22 2:59 PM, Terry Therneau wrote:
I'm working on registering all the routines in the survival package, per a 
request from
R-core.  Two questions:

1. In the coxph routine I have this type of structure:
       if (survival has 2 columns) routines <- c("coxfit5_a", "coxfit5_b", 
"coxfit5_c")
          else                     routines <- c("agfit5_a",  "agfit5_b",  
"agfit5_c")

.....

      .C(routines[1], arg1, etc

I tried replacing "routines" with a vector of native symbol references, but it doesn't work

Error in .C(routines[1], as.integer(n), as.integer(nvar), as.double(y),  :
    first argument must be a string (of length 1) or native symbol reference

I imagine routines is a list in this case, so you should be using routines[[1]] to extract the element, rather than subsetting the list.

Duncan Murdoch

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to