Description Usage Arguments Details See Also Examples
Combine data sources by rows or columns
1 2 3 4 5 6 7 |
... |
Objects to combine. Can be |
deparse.level |
For compatibility with the base |
.outFile |
Output format for the returned data. If not supplied, create an xdf tbl; if |
.rxArgs |
A list of RevoScaleR arguments. See |
Due to the specifics of how R searches for methods for cbind
and rbind
, there are a few caveats to using these. First, all the objects to be combined must be Xdf files for the correct method to be found; in particular, trying to combine a data frame and an Xdf file will result in an error (or bad output). Second, specifying the rxArgs
argument will fail if called from the generic. These issues can be worked around by calling the Xdf method directly: cbind.RxXdfData(xdf1, xdf2, .rxArgs=...)
, or rbind.RxXdfData(xdf1, xdf2, .rxArgs=...)
.
These methods also have some limitations compared to cbind
and rbind
for data frames. The cbind.RxXdfData
method will drop columns that have duplicate names, with a warning; this behaviour is different to cbind
with data frames, which will create an output df with duplicated names; and to dplyr::bind_cols
, which will rename columns to be unique. The rbind.RxXdfData
method will give an error if the columns in all the objects don't match, rather than creating new columns.
These methods support HDFS data in the local compute compute context, but not the Hadoop or Spark compute contexts.
cbind
and rbind
in base R,
bind_cols
and bind_rows
in package dplyr
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # cbind two Xdf files together
mtx <- as_xdf(mtcars, overwrite=TRUE)
tbl <- transmute(mtx, mpg2 = 2 * mpg)
cbind(mtx, tbl)
# rbind two Xdf files together
mtx2 <- as_xdf(mtcars, overwrite=TRUE)
rbind(mtx, mtx2)
# combine an Xdf file and a data frame: must explicitly call RxXdfData method
rbind.RxXdfData(mtx, mtcars)
# save to a persistent Xdf file: again, must explicitly call RxXdfData method
cbind.RxXdfData(mtx, tbl, .outFile="mtcars_cbind.xdf")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.