MERGE command in R

I am using the merge command and have run into a number of issues. I obtained some come to use that contains the section below.

I cannot figure out what the "incomparables" statement does. Can I use it to set no matches for a particular variable and can I change "NULL" to "NO"? What are the three notes that follow NULL is R expecting some additional code there?

suffixes = c(".SUPERS",".SAMPLE"), no.dups = TRUE, incomparables = NULL ...)

Here is a simple example of using the incomparables argument. I have never had a reason to use it, so I cannot comment much on it.

dfX <- data.frame(Name = c("A", "B", "C", "D", NA, "F"),
                  NumX = seq(1, 6))
dfY <- data.frame(Name = c("F", "E", NA, "C", "B", "A"),
                  NumY = seq(11, 16))
merge(dfX, dfY)
#>   Name NumX NumY
#> 1    A    1   16
#> 2    B    2   15
#> 3    C    3   14
#> 4    F    6   11
#> 5 <NA>    5   13
#If you do not want NA to produce a match
merge(dfX, dfY, incomparables = NA)
#>   Name NumX NumY
#> 1    A    1   16
#> 2    B    2   15
#> 3    C    3   14
#> 4    F    6   11

Created on 2019-06-30 by the reprex package (v0.2.1)
The three dots ... are used very commonly in R. They represent extra arguments passed to the function. The plot() function is a good example. i\If you look at the help for plot, it only lists three arguments, x, y and ... Depending on the exact method of plot being used, i.e. what kind of object you are passing to x and y, many other arguments may be used.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.