[R] Rare behaviour for nlme::reStruct example and question about ?lmeObject

Andrew Simmons @kw@|mmo @end|ng |rom gm@||@com
Wed Nov 16 00:01:55 CET 2022


This seems to be a bug. I tried creating this function in the global
environment:

str.pdMat <- function (object, ...)
{
    if (nlme::isInitialized(object)) {
        NextMethod()
    }
    else {
        cat(" Uninitialized positive definite matrix structure of class ",
            class(object)[1], ".\n", sep = "")
    }
}

and the code you sent works:

> library(nlme)
> rs1 <- reStruct(list(Dog = ~day, Side = ~1), data = Pixel)
> rs1
Uninitialized random effects structure
> str(rs1)
List of 2
 $ Side: Uninitialized positive definite matrix structure of class pdLogChol.
 $ Dog : Uninitialized positive definite matrix structure of class pdLogChol.
 - attr(*, "settings")= int [1:5] 0 1 0 4 4
 - attr(*, "class")= chr "reStruct"
>

I'll suggest adding it, hopefully it will appear in the next update.
In the meantime, you could add the function to your Rprofile,
something like:

con <- file("~/.Rprofile", "a")
writeLines(r"(str.pdMat <- function (object, ...)
{
    if (nlme::isInitialized(object)) {
        NextMethod()
    }
    else {
        cat(" Uninitialized positive definite matrix structure of class ",
            class(object)[1], ".\n", sep = "")
    }
})", con)
close(con)

so that every time you start a new R session, this function is added
to your global environment.

On Tue, Nov 15, 2022 at 5:20 PM Iago <iago.gine using sjd.es> wrote:
>
> Dear Bert and all other "helpers",
>
>
> I agree that not all of you are developers. If I look at the DESCRIPTION
> of the nlme package I can see the next:
>
>     Contact: see 'MailingList'
>
>     BugReports: https://bugs.r-project.org
>     MailingList: R-help using r-project.org
>
>     Maintainer: R Core Team <R-core using R-project.org>
>
> As I do not have bugs.r-project account, first I emailed to
> R-core using R-project.org, from where I got the next answer
>
>     "Non-members are typically*NOT*  allowed to post messages to this
>     private developers' list. Please use an appropriate mailing list (from
>     http://www.r-project.org/mail.html). For R packages, use
>     maintainer("<pkg>") in R (and if that is R-core using .., use the R-help
>     address).
>
>     --> i.e. for nlme  use  R-help
>
> by Martin Maechler. Therefore, I used R-help.
>
> Best,
>
> Iago
>
>
> On 15/11/2022 16:20, Bert Gunter wrote:
> > 1. Not developers, helpers (though there may be some developers among
> > us, too). Ergo, we don't make changes to code or man pages either.
> >
> > 2. If no satisfactory reply here, R-Sig-mixed-models is where you
> > should post. And post there first for mixed models questions in future.
> >
> > Cheers,
> > Bert
> >
> >
> > On Mon, Nov 14, 2022 at 11:24 PM IAGO GINÉ VÁZQUEZ <iago.gine using sjd.es>
> > wrote:
> >
> >     Dear developers,
> >
> >     When I run the example code in the help of reStruct, I get
> >
> >
> >     > library(nlme)
> >     > rs1 <- reStruct(list(Dog = ~day, Side = ~1), data = Pixel)
> >     > rs1
> >     Uninitialized random effects structure
> >     > str(rs1)
> >     List of 2
> >      $ Side:Error in pdMatrix.pdSymm(x) :
> >       cannot extract matrix from an uninitialized object
> >
> >
> >     Is it expected?
> >
> >     In addition to that I would like to ask if shouldn't be `terms`
> >     documented in `?lmeObject`.
> >
> >
> >     Kind regards,
> >
> >     Iago
> >
> >
> >
> >
> >             [[alternative HTML version deleted]]
> >
> >     ______________________________________________
> >     R-help using 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
> >     <http://www.R-project.org/posting-guide.html>
> >     and provide commented, minimal, self-contained, reproducible code.
> >
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using 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