Sorry, I am still not understanding this. I tried using the unlock binding function, but the function remains unchanged after I attempt an assignment:
> library(nlme) > bindingIsLocked("corExp",environment(corExp)) [1] TRUE > unlockBinding("corExp",environment(corExp)) > bindingIsLocked("corExp",environment(corExp)) [1] FALSE > assignInNamespace("corExp", + function (value = numeric(0), form = ~1, nugget = FALSE, metric = c("euclidean", + "maximum", "manhattan"), fixed = FALSE) + { + cat("corExp\n") ## SLIGHTLY CHANGE FUNCTION BY ADDING THIS LINE + attr(value, "formula") <- form + attr(value, "nugget") <- nugget + attr(value, "metric") <- match.arg(metric) + attr(value, "fixed") <- fixed + class(value) <- c("corExp", "corSpatial", "corStruct") + value + }, + environment(corExp)) > corExp function (value = numeric(0), form = ~1, nugget = FALSE, metric = c("euclidean", "maximum", "manhattan"), fixed = FALSE) { attr(value, "formula") <- form attr(value, "nugget") <- nugget attr(value, "metric") <- match.arg(metric) attr(value, "fixed") <- fixed class(value) <- c("corExp", "corSpatial", "corStruct") value } <environment: namespace:nlme> On Mon, Apr 26, 2010 at 11:25 PM, Gabor Grothendieck < ggrothendi...@gmail.com> wrote: > See ?lockBinding > > On Mon, Apr 26, 2010 at 11:20 PM, Michael Steven Rooney > <michael.s.roo...@gmail.com> wrote: > > I tried editing the corExp function (added a line) within the nlme > > environment with the following code, but it looks like my declaration did > > not have any effect. I am guessing it is locked some how. Is there an > easy > > way to do this or am I treading into complicated waters? (I just picked > up R > > a year ago, and I don't have any experience in development. Willing to > > learn.) > > > >> assignInNamespace("corExp", > > + function (value = numeric(0), form = ~1, nugget = FALSE, metric = > > c("euclidean", > > + "maximum", "manhattan"), fixed = FALSE) > > + { > > + cat("corExp\n") # I ADDED THIS LINE HERE > > + attr(value, "formula") <- form > > + attr(value, "nugget") <- nugget > > + attr(value, "metric") <- match.arg(metric) > > + attr(value, "fixed") <- fixed > > + class(value) <- c("corExp", "corSpatial", "corStruct") > > + value > > + }, > > + environment(corExp)) > >> corExp > > function (value = numeric(0), form = ~1, nugget = FALSE, metric = > > c("euclidean", > > "maximum", "manhattan"), fixed = FALSE) > > { > > attr(value, "formula") <- form > > attr(value, "nugget") <- nugget > > attr(value, "metric") <- match.arg(metric) > > attr(value, "fixed") <- fixed > > class(value) <- c("corExp", "corSpatial", "corStruct") > > value > > } > > <environment: namespace:nlme> > > > > > > On Mon, Apr 26, 2010 at 10:46 PM, Michael Steven Rooney > > <michael.s.roo...@gmail.com> wrote: > >> > >> Thanks. > >> > >> How do I make my function visible to others? Will assignInNamespace do > >> that? > >> > >> On Mon, Apr 26, 2010 at 10:23 PM, Gabor Grothendieck > >> <ggrothendi...@gmail.com> wrote: > >>> > >>> See ?assignInNamespace > >>> > >>> On Mon, Apr 26, 2010 at 9:49 PM, Michael Steven Rooney > >>> <michael.s.roo...@gmail.com> wrote: > >>> > Hi, > >>> > > >>> > I am trying to place my own functions in the nlme environment: > >>> > > >>> > The following statement works: > >>> > > >>> > environment(coef.corSPT) <- > >>> > environment(getS3method("coef","corSpatial")) > >>> > > >>> > but this one returns an error: > >>> > > >>> > environment(get("coef<-.corSPT")) <- > >>> > environment(getS3method("coef<-","corSpatial")) > >>> > Error in environment(get("coef<-.corSPT")) <- > >>> > environment(getS3method("coef<-", : > >>> > target of assignment expands to non-language object > >>> > > >>> > What should I do? > >>> > > >>> > Thanks. > >>> > > >>> > Mike > >>> > > >>> > [[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. > >>> > > >> > > > > > [[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.