[R] survival package can't find Ccoxfit6
Henric Winell
nilsson.henric at gmail.com
Fri Apr 28 23:37:47 CEST 2017
On 2017-04-26 22:17, Duncan Murdoch wrote:
> On 26/04/2017 2:51 PM, Therneau, Terry M., Ph.D. wrote:
>> A user contacted me directly about this, I answered with my best
>> understanding of the
>> recent R-help discussion of the issue, and their response to my
>> response shows that I'm
>> not quite right.
>>
>> I am emphatically not an MS Windows user so am asking for help --
>> which I will cut/paste
>> to this user and to the next dozen who will invariably contact me
>> directly.
>>
>> Thanks,
>> Terry Therneau
>>
>>
>>
>> -------- Forwarded Message --------
>> Subject: RE: survival package
>> Date: Wed, 26 Apr 2017 18:05:30 +0000
>> From: SeshanV at mskcc.org
>> To: Therneau, Terry M., Ph.D. <therneau at mayo.edu>
>>
>> Thank you for the quick response. The session info command for v3.4.0
>> does in fact report
>> survival_2.41-3. Furthermore, while both v3.3.1 and v3.40 are on the
>> same computer the
>> library paths do not have any directory in common:
>>
>>> .libPaths()
>> [1] "C:/Program Files/R/R-3.4.0/library"
>>>
>>
>> and
>>> .libPaths()
>> [1] "C:/Program Files/R/R-3.3.1/library"
>>>
>>
>>
>> Thanks,
>> Venkat
>>
>>
>> -----Original Message-----
>> From: Therneau, Terry M., Ph.D. [mailto:therneau at mayo.edu] Sent:
>> Wednesday, April 26, 2017
>> 1:42 PM
>> To: Seshan, Venkatraman E./Epidemiology-Biostatistics
>> Subject: Re: survival package
>>
>> This has been discussed in R-help by multiple people. You have a
>> pre-3.4 version of the
>> survival package somewhere on your search path, and the method for
>> resolving .C calls has
>> changed. The sessionInfo command should report survival version 2.41-3.
>>
>> Terry T.
>>
>>
>> On 04/26/2017 12:17 PM, SeshanV at mskcc.org wrote:
>>> Dear Prof. Therneau,
>>>
>>> I am encountering an error message when I try to use the coxfit6
>>> routine from the survival package under the 3.4.0 version of R. The
>>> minimal function and the script are in the attached file. This
>>> function worked under earlier versions of R.
>>>
>>> ----------------------------------------------------------------------
>>> -------------------------
>>>
>>> ***************************
>>> ** Works under R-3.3.1 **
>>> ***************************
>>>
>>>> source("coxfit6-issue.R")
>>> [1] -0.4838181
>>>
>>>> sessionInfo()
>>> R version 3.3.1 (2016-06-21)
>>> Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64
>>> (build 7601) Service Pack 1
>>>
>>> locale:
>>> [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United
>>> States.1252 [3] LC_MONETARY=English_United States.1252 [4]
>>> LC_NUMERIC=C [5] LC_TIME=English_United States.1252
>>>
>>> attached base packages:
>>> [1] stats graphics grDevices utils datasets methods base
>>>
>>> other attached packages:
>>> [1] survival_2.39-4
>>>
>>> loaded via a namespace (and not attached):
>>> [1] Matrix_1.2-6 splines_3.3.1 grid_3.3.1 lattice_0.20-33
>>>
>>> ----------------------------------------------------------------------
>>> -------------------------
>>>
>>> ***********************************
>>> ** Does not work under R-3.4.0 **
>>> ***********************************
>>>
>>>> library(survival)
>>>> source("coxfit6-issue.R")
>>> Error in .Call("Ccoxfit6", as.integer(control$iter.max), stime,
>>> as.integer(sstat), :
>>> "Ccoxfit6" not available for .Call() for package "survival"
>
> As far as I can see, that line doesn't appear in the current survival
> source code, it's from some earlier version of the package. The current
> one has
>
> coxfit <- .Call(Ccoxfit6,
> as.integer(maxiter),
> stime,
> sstat,
> x[sorted,],
> as.double(offset[sorted]),
> weights,
> newstrat,
> as.integer(method=="efron"),
> as.double(control$eps),
> as.double(control$toler.chol),
> as.vector(init),
> as.integer(1)) # internally rescale
>
> There are several differences, the one leading to the error being the
> change from "Ccoxfit6" in quotes, to Ccoxfit6 not in quotes. That
> corresponds to the difference between a registered symbol and an
> unregistered one.
I think it's worthwhile to point out that non-exported symbols are
available using ':::'. See WRE Section 5.4.
So, after fixing the argument list, just use '.Call(survival:::Ccoxfit6,
<args>)' instead of '.Call("Ccoxfit6", <args>, PACKAGE = "survival")'.
Henric Winell
>
> Without seeing the code that led to the error message I can't really say
> how the error came about. There are a few ways:
>
> - The user has a copy of the coxph.fit function from an older version of
> survival saved in their workspace, and are using that one instead of the
> current one.
>
> - Some part of your code returns functions, and one of those is making
> this call based on an object produced in an earlier version of survival.
>
> - There are really two versions of survival on the search path (or
> perhaps copied bits of one), and this call isn't in survival 2.41-3 at all.
>
> Duncan Murdoch
>
>>>> sessionInfo()
>>> R version 3.4.0 (2017-04-21)
>>> Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64
>>> (build 7601) Service Pack 1
>>>
>>> Matrix products: default
>>>
>>> locale:
>>> [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United
>>> States.1252 [3] LC_MONETARY=English_United States.1252 [4]
>>> LC_NUMERIC=C [5] LC_TIME=English_United States.1252
>>>
>>> attached base packages:
>>> [1] stats graphics grDevices utils datasets methods base
>>>
>>> other attached packages:
>>> [1] survival_2.41-3
>>>
>>> loaded via a namespace (and not attached):
>>> [1] compiler_3.4.0 Matrix_1.2-9 splines_3.4.0 grid_3.4.0
>>> [5] lattice_0.20-35
>>>
>>> ----------------------------------------------------------------------
>>> -------------------------
>>>
>>> When I remove the quotes surrounding Ccoxfit6 in the function both
>>> versions give the error:
>>>
>>> Error in phcoefs(stim[ii], sts[ii], as.matrix(as.double(cvt[ii])),
>>> oo$coefficients, :
>>> object 'Ccoxfit6' not found
>>>
>>>
>>> I would greatly appreciate your help in resolving this.
>>>
>>> Thanks,
>>> Venkat Seshan
>>>
>>
>>
>> =====================================================================
>>
>> Please note that this e-mail and any files transmitted from
>> Memorial Sloan Kettering Cancer Center may be privileged,
>> confidential,
>> and protected from disclosure under applicable law. If the
>> reader of
>> this message is not the intended recipient, or an employee or agent
>> responsible for delivering this message to the intended recipient,
>> you are hereby notified that any reading, dissemination,
>> distribution,
>> copying, or other use of this communication or any of its
>> attachments
>> is strictly prohibited. If you have received this communication in
>> error, please notify the sender immediately by replying to this
>> message
>> and deleting this message, any attachments, and all copies and
>> backups
>> from your computer.
>>
>> ______________________________________________
>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list