[R] merge in function

Marc Schwartz marc_schwartz at comcast.net
Thu Dec 6 20:14:34 CET 2007

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.


Marc Schwartz

More information about the R-help mailing list