[R] existing package (mmlcr) modification -- appropriate process?

Jennifer Thacher jthacher at unm.edu
Fri May 30 03:19:18 CEST 2008


All:

I am new to R and would like your help in identifying the appropriate  
process to follow in order to modify the output from an existing  
package. I've had difficulty finding an answer online, perhaps because  
I am using incorrect terminology.

A package that I am using (mmlcr) invokes another package (multinom).  
An output of multinom is the standard errors, but this output is not  
provided within mmlcr. I would like to obtain the standard errors as  
an output of mmlcr.

For your reference, this is relevant code that I identified in mmlcr,  
using getAnywhere{mmlcrfit.multinomlong}:
function (object, weights, classnumber)
{
     data <- object$data
     form.full <- formula(attr(data, "terms"))
     form <- object$shortform
     data$.wts <- weights[match(getGroups(data, form.full, 1),
         row.names(weights)), classnumber]
     component.multinom.result <- multinom(form, data = data,
         weights = .wts, na.action = na.exclude, subset = (.wts >
             0), maxit = 150, trace = FALSE)
     object$coef[[classnumber]] <-  
pmin(pmax(coef(component.multinom.result),
         -30), 30)
     object
}

This code passes coefficient estimates from multinom to the mmlcr  
object. I would like for the program to also pass through the standard  
error estimates. If this was my own code, I could just add a line to  
the above function. But in this case, since it is someone's else's  
code, I'm unsure how to modify it. Do I need to create a package  
(e.g., follow the process outlined in Writing R Extensions) in order  
to do this? Or is there a simpler process? Any suggested reading on  
how to do this, would be greatly appreciated.

Thank you very much for your help.

Jenn



More information about the R-help mailing list