I used merge() in a function, but it doesn't return correct data frame.
add.name <- function(data, x)
{
...
...
newfile <- merge(data, resid, by =0, all.x=TRUE, all.y= FALSE)
newfile
}
---------------------------------
[[alternative HTML version deleted]]
On Thu, 2007-12-06 at 09:27 -0800, qian z wrote:> I used merge() in a function, but it doesn't return correct data frame. > > add.name <- function(data, x) > > { > > ... > ... > > newfile <- merge(data, resid, by =0, all.x=TRUE, all.y= FALSE) > newfile > > > }You are going to need to give us more information. It is not clear what you mean by not returning the correct data frame. Why is it not correct? Where and what is 'resid'? What is 'x' and how is it used in the function? What is 'by = 0'? The 'by' argument values need to be quoted. Please provide a small reproducible example as per the Posting Guide. HTH, Marc Schwartz
I think we need some actual sample code . Also by= 0 seems a bit funny. --- qian z <qianpland at yahoo.com> wrote:> I used merge() in a function, but it doesn't return > correct data frame. > > add.name <- function(data, x) > > { > > ... > ... > > newfile <- merge(data, resid, by =0, all.x=TRUE, > all.y= FALSE) > newfile > > > } >