Mike Rennie
2013-Aug-02 14:34 UTC
[R] Editing code in a function? related to allowing zero weights in lmer()
To close the thread, I wanted to post my solution to this issue. Searching some other help threads, I found this: https://stat.ethz.ch/pipermail/r-help/2008-August/171321.html So, here's what I did: I got at the script for lmerFrames by doing this: edit(lme4:::lmerFrames) then edited the code to allow zero weights, and assigned it to a new function: my.lmerFrames<-function (...} and then did this: library(R.utils) reassignInPackage("lmerFrames", pkgName="lme4", my.lmerFrames) Voila, things execute, no error. Note also that R.utils requires some additional packages (R.oo, R.methodsS3 before you can use it. On Fri, Aug 2, 2013 at 12:03 AM, Mike Rennie <mikerennie.r@gmail.com> wrote:> Indeed- thanks for the tips to get me going. This just kicks things up a > notch for me, having happily used packages without wanting to tinker with > them till now. > > Cheers. > > > On Thu, Aug 1, 2013 at 11:57 PM, Bert Gunter <gunter.berton@gene.com>wrote: > >> 1. ?"::" >> >> 2. ?getAnywhere >> >> 3. Please consult the "R language definition" manual -- or even "An >> Introduction to R" -- to learn about R programming. It **is** a >> programming language, you know! >> >> Cheers, >> Bert >> >> On Thu, Aug 1, 2013 at 8:54 PM, Mike Rennie <mikerennie.r@gmail.com> >> wrote: >> > Hi folks, >> > >> > I've not before had to edit code right in a function, but I think I need >> > to. I am using lmer() and want to use a model that uses zero weights. I >> > found this thread from 2009: >> > >> > https://stat.ethz.ch/pipermail/r-sig-mixed-models/2009q1/001995.html >> > >> > but I'm unsure of how I would actually go about editing the code in the >> > package. >> > >> > Part of the problem is that I can't even find lmerFrames(). I can see it >> > being called in lmer, but if I just type in >> > >> > lmerFrames >> > >> > or >> > >> > fix(lmerFrames) >> > >> > I get nothing. >> > >> > The note from Doug Bates is that the function is "hidden"- is there a >> trick >> > to getting at these hidden functions to edit them? >> > >> > Any thoughts or suggestions welcome. >> > >> > Cheers, >> > >> > -- >> > Michael Rennie, Research Scientist >> > Fisheries and Oceans Canada, Freshwater Institute >> > Winnipeg, Manitoba, CANADA >> > >> > [[alternative HTML version deleted]] >> > >> > ______________________________________________ >> > R-help@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. >> >> >> >> -- >> >> Bert Gunter >> Genentech Nonclinical Biostatistics >> >> Internal Contact Info: >> Phone: 467-7374 >> Website: >> >> http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm >> > > > > -- > Michael Rennie, Research Scientist > Fisheries and Oceans Canada, Freshwater Institute > Winnipeg, Manitoba, CANADA >-- Michael Rennie, Research Scientist Fisheries and Oceans Canada, Freshwater Institute Winnipeg, Manitoba, CANADA [[alternative HTML version deleted]]