Hi, there,

I have a question about multinom rountine. The response is a matrix, and the predicator is
a data frame called dat. I would like multinom to get response and data from within this function
test instead of from R Console session.
---------------------------------------------------------------------
test <- function()
{
library(nnet)
response <- diag(1,3)
dat <- as.data.frame(matrix(round(rnorm(6)),3,2))
fit <- summary(multinom(response ~ ., data=dat))
coefficients <- fit$coefficients
return(coefficients)
}
--------------------------------------------------------------------------

The response and dat are two different data sets, and one does not include another.
But it seems multinom automatically get data and response from R Console environment, not the
function test itself. So when I run the above function (assume that in R console we don't have objects response and dat), it gives error: cannot find response and dat.

How can I let multinom get the data for the formula from within the function test without assigning response and dat into the R console environment.
Thanks very much.

Jun Han


	[[alternative HTML version deleted]]


