Skip to content
Prev 75429 / 398502 Next

coercing created variables into a new data frame using na.omit()

I don't know if you can read your message, but I find it exceedingly 
difficult and there seem to be several typos.  Please use the space and 
return keys ... and only send a message once.

You problem is perhaps that you are not looking at the data frame, but at 
the variable in the workspace.  attach()ing data frames is convenient but 
error-prone (as you have found).  rm(new.variable) should solve this, but 
it is better to cultivate a different style.  For example

with(data.frame1, {
# commands to create value
data.frame1$new.variable <- value
})
data.frame3 <- na.omit(data.frame1)

I think too that the creation of the value can be vectorized simply, 
generalizing something like

value <- (age1 - 7)*(weight - mw)
On Fri, 12 Aug 2005, sp219 wrote: