|
Hello S users,
This is probably a very simple problem, but I am
not well versed in Splus.
I am trying to extract the response vector used to
fit a multinom object. Specifically, I'm trying to reconstruct the response vector by extracting the name of
the data and the name of the response variable from the multinom object, then
using them in combination to retrieve the response vector. The code I'm
trying to use is:
# Set up response variable name.
data <-
multinom.model@call[[3]]
yvar <-
multinom.model@formula[[2]]
varname <- as.character(paste(data, "$",
yvar, sep="", collapse=""))
# Extract response (y) vector.
y <- get(varname,
immediate=T)
I can get the data name and the y-response name to
combine in the paste statement, but I'm clueless how to actually get the
response vector with that information.
varname returns
> "LWD$FUNCTION"
which is what I think I want since the data frame
is "LWD" and the response variable is called "FUNCTION".
y returns
> Problem
in get(varname, immediate = T): Object "LWD$FUNCTION" not found
Use traceback() to see the call
stack
definitely not what I was looking for.
Again, this is probably quite simple, but I'm
stumped.
Thanks very much.
Jeff.
|