Description Usage Arguments Value Examples
Join (merge) two data frames
1 2 3 4 5 6 7 8 9 10 |
x |
data frame |
y |
data frame |
by |
column names |
xLast |
Whether to reuse rows of x |
yLast |
Whether to reuse rows of y |
xAll |
Whether to match all rows of x by adding NAs |
yAll |
Whether to match all rows of y by adding NAs |
doSort |
Whether to sort on the by columns |
data frame
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | x <- data.frame(ABC = c("A", "A", "A", "B", "B", "B", "B", "C", "C"),
OneTwo = c(1, 1, 1, 1, 1, 2, 1, 1, 1),
x = 10 * (1:9), stringsAsFactors = FALSE)
y <- data.frame(ABC = c("A", "A", "A", "B", "C", "C"),
OneTwo = c(1, 1, 2, 1, 1, 2),
y = 101:106, stringsAsFactors = FALSE)
x
y
# Inner join
SasJoin(x, y, xLast = FALSE, yLast = FALSE, xAll = FALSE, yAll = FALSE)
# Left join
SasJoin(x, y, xLast = FALSE, yLast = FALSE, xAll = TRUE, yAll = FALSE)
# Left join by reusing rows of y when possible
SasJoin(x, y, xLast = FALSE, yLast = TRUE, xAll = TRUE, yAll = FALSE)
# Reusing rows of y when possible but not a full left join
SasJoin(x, y, xLast = FALSE, yLast = TRUE, xAll = FALSE, yAll = FALSE)
# Reusing rows of both x and y
SasJoin(x, y, xLast = TRUE, yLast = TRUE, xAll = FALSE, yAll = FALSE)
# Outer join by reusing rows of both x and y
SasJoin(x, y, xLast = TRUE, yLast = TRUE, xAll = TRUE, yAll = TRUE)
# Outer join without reusing rows
SasJoin(x, y, xLast = FALSE, yLast = FALSE, xAll = TRUE, yAll = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.