This is very similar to my previous post on
this problem, but I have pinned down my issue. Perhaps someone on this
list would be kind enough to help me solve this.
I am trying to extract a vector (column) from a
data frame using the code below. I first define the data frame and
target vector (column) names as variables. Then I attempt to use get()
to extract the target vector. That is where I am having
difficulty. Here is the code
#
# Get response variable name components.
data <-
as.character(multinom.model@call[[3]])
yvar <-
as.character(multinom.model@formula[[2]])
#
# Extract response (y) vector.
y <- get(data)$yvar
#
The problem is the way yvar gets treated in the get statement. I know this because if I
manually replace yvar with a valid column
name, I get the correct behavior. I simply have no idea how to get yvar to be treated correctly in the get() statement. As it is now, I get
NULL result for y. Any help
here is much appreciated.
Thank you very much,
jeff.