Hi All, Im looking for some help passing function arguments and referencing them, I've made a replica, less complicated function to show my problem, and how i've made a work around for this. However i suspect there is a _FAR_ better way of doing this.
If i do: BuildDecayModel <- function(x = "this", y = "that", data = model.data) { model <- nls(y ~ SSexp(x, y0, b), data = model.data) return(model) } ... "Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 0 (non-NA) cases" This function returns an error because the args are passed as "this" and "that" to the model, and so fails (correct?) If i do the following: BuildDecayModel <- function(x = "total.reach", y = "lift", data = model.data) { x <- data[[x]] y <- data[[y]] model.data <- as.data.frame(cbind(x,y)) model <- nls(y ~ SSexp(x, y0, b), data = model.data) return(model) } This works for me, but it seems that i'm missing a trick with just manipulating the args rather than making an entire new data.frame to work off, Can anyone offer some advice? Thanks in advance 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.