[R] Using nlme and coxme (both!): Looking for workaround
Douglas Bates
bates at stat.wisc.edu
Thu Mar 18 15:31:11 CET 2010
On Thu, Mar 18, 2010 at 6:26 AM, Dieter Menne
<dieter.menne at menne-biomed.de> wrote:
> I am trying to use nlme and coxme in one Sweave document. I have read the
> thread in r-devel on the subject,
>
> http://markmail.org/thread/snchg6ynofrzbf2v
>
> and nlme::fixef works, but I did not understand what workaround to use when
> I am calling a function in a package that I do not want to change.
We discussed a fix for that which is to add a line to the NAMESPACE
file for any packages that want to define methods for the fixef or
ranef generic. The line is simply
importFrom(nlme, fixef, ranef)
I thought Terry was going to add that in the coxme sources.
>
> library(nlme)
> library(coxme) # hides fixef, among others
>
> deplynestedforeingpackagefunction = function(x){
> # I do not want to change this function in another package
> fixef(x)
> }
>
> fit <- coxme(Surv(time, status) ~ age + (1|ph.ecog), lung)
> fixef(fit)
>
> fm1 <- lme(distance ~ age, data = Orthodont)
> nlme::fixef(fm1) # can use nlme::
> #
> deplynestedforeingpackagefunction(fm1) #error
>
>
>
> R version 2.10.1 (2009-12-14)
> i386-pc-mingw32
>
> locale:
> [1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252
> [3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
> [5] LC_TIME=German_Germany.1252
>
> attached base packages:
> [1] splines stats graphics grDevices datasets utils methods
> base
>
> other attached packages:
> [1] coxme_2.0 bdsmatrix_1.0 survival_2.35-8 nlme_3.1-96
>
> loaded via a namespace (and not attached):
> [1] grid_2.10.1 lattice_0.18-3 tools_2.10.1
>>
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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