[Rd] loading of an unwanted namespace

Duncan Murdoch murdoch.duncan at gmail.com
Thu May 2 22:35:45 CEST 2013


On 13-05-02 3:05 PM, Terry Therneau wrote:
> I have a debugging environment for the survival package, perhaps unique to me, but I find
> it works very well.
> To wit, a separate directory with copies of the source code but none of the package
> accuements of DESCRIPTION, NAMESPACE, etc. This separate space does NOT contain a copy of
> src/init.c
> Within this I use R --vanilla, attach my .RData file, survival.so file, and away we go.
>
> That is, until my first useage of it today under R 3.0. My runs get into trouble with
> messages about
> "conflicts with the survival namespace". My problem is that I can't figure out where or
> how the name space is being searched out and attached. Any hints on where to look would be
> appreciated. This "magical" load is
> kind of spooky.
>
> Here is a session that displays it. The "setup.s" file does the dyn.load and attaches some
> data sets.

I don't know a direct way to find this, but you could add some debugging 
code to the .Onload function in survival, e.g. to print what the stack 
is like when it's loading.  That should be informative.

Duncan Murdoch


>
> tmt-local3499% R --vanilla
>
> R version 3.0.0 (2013-04-03) -- "Masked Marvel"
> Copyright (C) 2013 The R Foundation for Statistical Computing
> Platform: i686-pc-linux-gnu (32-bit)> source('setup.s')
>   > sessionInfo()
> R version 3.0.0 (2013-04-03)
> Platform: i686-pc-linux-gnu (32-bit)
>
> locale:
> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
> [3] LC_TIME=en_US.UTF-8 LC_COLLATE=C
> [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
> [7] LC_PAPER=C LC_NAME=C
> [9] LC_ADDRESS=C LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] splines stats graphics grDevices utils datasets methods
> [8] base
>   > search()
> [1] ".GlobalEnv" "file:../.RData" "file:../data/.RData"
> [4] "package:splines" "package:stats" "package:graphics"
> [7] "package:grDevices" "package:utils" "package:datasets" > coxph(Surv(time, status) ~
> age, data=lung)
> Call:
> coxph(formula = Surv(time, status) ~ age, data = lung)
>
>
> coef exp(coef) se(coef) z p
> age 0.0187 1.02 0.0092 2.03 0.042
>
> Likelihood ratio test=4.24 on 1 df, p=0.0395 n= 228, number of events= 165
>   >
>   > # That worked fine, but the next fails
>   > coxph(Surv(time, status) ~ pspline(age), data=lung)
> Error in FUN(X[[2L]], ...) :
> (converted from warning) failed to assign RegisteredNativeSymbol for Cagfit5a to Cagfit5a
> since Cagfit5a is already defined in the ‘survival’ namespace
>   >
>   > sessionInfo()
> R version 3.0.0 (2013-04-03)
> Platform: i686-pc-linux-gnu (32-bit)
>
> locale:
> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
> [3] LC_TIME=en_US.UTF-8 LC_COLLATE=C
> [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
> [7] LC_PAPER=C LC_NAME=C
> [9] LC_ADDRESS=C LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] splines stats graphics grDevices utils datasets methods
> [8] base
>   >
>
> [10] "package:methods" "Autoloads" "package:base"
>   >
>   > options(warn=2)
>
>
> R is free software and comes with ABSOLUTELY NO WARRANTY.
> You are welcome to redistribute it under certain conditions.
> Type 'license()' or 'licence()' for distribution details.
>
> Natural language support but running in an English locale
>
> R is a collaborative project with many contributors.
> Type 'contributors()' for more information and
> 'citation()' on how to cite R or R packages in publications.
>
> Type 'demo()' for some demos, 'help()' for on-line help, or
> 'help.start()' for an HTML browser interface to help.
> Type 'q()' to quit R.
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



More information about the R-devel mailing list