Skip to content
Prev 264547 / 398506 Next

Tables and merge

On Jul 6, 2011, at 7:36 AM, Silvano wrote:

            
Suggestion # 1: Read the Posting Guide. In there you are advised to  
report the verbatim text from error messages. Reading error messages  
is often informative.

Suggestion # 2: Report the results of `str` on all of those "q"  
objects. We need to see whether there are the necessary common column  
names that would support a merge operation.

Suggestion #3 : read the ?merge page and pay particular attention to  
number ("two") in the title.

consider this possibility after further reading of ?merge and a bit of  
testing.

merge(x=q1, y=list(q2,q3,q4,q5,q6,q7,q8) )

# Your error occurred because of positional matching. The q3 object is  
being assigned to the third argument , "by= ", and that is what your  
unreported error message was telling you.

That construction seemed to work without error on a test I did with a  
slight modification of the first example on ?merge. After making the  
author column have the same name = `name`, I also got success with:

do.call("merge", list(x=authors, y=list(books, books)))

The non-do,call simplification above was not entirely predictably  
correct (to me anyway) , since the ?merge page does not say that a  
list object holding dataframes would be an acceptable "y" argument.  
But I see that as.data.frame(list(books, books)) does produce a  
data.frame and coercion with as.data.frame on that list object is  
probably what happened in the merge() call.