Re: [R] restrictions for attribute access <Watchdog: Virus checked>

From: Benjamin Polak <benjamin.polak_at_unisg.ch>
Date: Wed, 02 Apr 2008 14:58:08 +0200

Thanks for your help, Henrique!

It's the same problem as I stated in my original post. The code works if it runs as a regular R script, but not if it runs within a custom package. Somehow, if the code is in the package, it doesn't "see" the attribute anymore. I don't understand why. I've played around with different imports in my NAMESPACE file, but it didn't help.

On Wednesday, 2. April 2008 14:41, Henrique Dallazuanna wrote:
> Work's for me:
>
> summary(lmer(Reaction ~ Days + (Days|Subject), sleepstudy))@AICtab
>
>
> On Wed, Apr 2, 2008 at 9:36 AM, Benjamin Polak
> <benjamin.polak_at_unisg.ch>
>
> wrote:
> > Thanks, but it doesn't work, I get the error message:
> >
> > 'no slot of name "AICtab" for this object of class "table"'
> >
> > On Wednesday, 2. April 2008 13:34, Henrique Dallazuanna wrote:
> > > You've tried:
> > >
> > > tab <- smry_at_AICtab
> > >
> > > ?
> > >
> > > On Wed, Apr 2, 2008 at 7:59 AM, Benjamin Polak
> >
> > <benjamin.polak_at_unisg.ch> wrote:
> > > > Hello everybody,
> > > >
> > > > I have a problem with accessing class attributes. I think it
> > > > might be due to namespace access restrictions or something
> > > > similar, but I'm unable to figure it out, maybe someone knows
> > > > the trick how to do it ...
> > > >
> > > > I'm trying to extract some information from the summary
> > > > object for a model fitted using the lmer function from the
> > > > lme4 package:
> > > >
> > > > smry <- summary(lmer(foo ~ bar ...))
> > > > tab <- attr(smry, "AICtab")
> > > > tab$AIC
> > > >
> > > > When I run this code as a regular R script everything works
> > > > fine, tab$AIC has the desired value. But when I try to run
> > > > this code from within a package I wrote, tab$AIC is NULL.
> > > >
> > > > I've tried adding "import(lme4)", "importClassesFrom(lme4)"
> > > > and "importMethodsFrom(lme4)" into the NAMESPACE file of my
> > > > package, but it didn't help, tab$AIC is still NULL.
> > > >
> > > > Thanks for any kind of hint!
> > > >
> > > > Best Regards,
> > > > Ben
> >
> > ______________________________________________
> > 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.

-- 
Dipl.-Inf. Benjamin Polak
Forschungsstelle für Business Metrics
Universität St. Gallen
Guisanstrasse 1a
CH-9010 St. Gallen
fon: +41 71 224 2138
fax: +41 71 224 2132
http://www.fbm.unisg.ch

______________________________________________
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.
Received on Wed 02 Apr 2008 - 13:00:32 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 02 Apr 2008 - 13:30:25 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive