mergeAllXY | R Documentation |
Merge list of data.frames retaining all rows
mergeAllXY(...)
... |
arguments are handled as described:
|
This function is a wrapper around base::merge.data.frame()
except that it allows more than two data.frame objects,
and applies default arguments all.x=TRUE
and all.y=TRUE
for each merge operation to ensure that all rows are kept.
data.frame
after iterative calls to base::merge.data.frame()
.
Other jam practical functions:
breakDensity()
,
checkLightMode()
,
check_pkg_installed()
,
colNum2excelName()
,
color_dither()
,
diff_functions()
,
exp2signed()
,
fileInfo()
,
fixYellow()
,
getAxisLabel()
,
handleArgsText()
,
heads()
,
isFALSEV()
,
isTRUEV()
,
jamba
,
jargs()
,
kable_coloring()
,
lldf()
,
log2signed()
,
make_html_styles()
,
make_styles()
,
match_unique()
,
middle()
,
minorLogTicks()
,
newestFile()
,
printDebug()
,
renameColumn()
,
rmInfinite()
,
rmNAs()
,
rmNA()
,
rmNULL()
,
sclass()
,
sdim()
,
setPrompt()
Other jam list functions:
cPasteSU()
,
cPasteS()
,
cPasteUnique()
,
cPasteU()
,
cPaste()
,
heads()
,
jam_rapply()
,
list2df()
,
mixedSorts()
,
rbindList()
,
relist_named()
,
rlengths()
,
sclass()
,
sdim()
,
uniques()
,
unnestList()
df1 <- data.frame(City=c("New York", "Los Angeles", "San Francisco"),
State=c("New York", "California", "California"))
df2 <- data.frame(Team=c("Yankees", "Mets", "Giants", "Dodgers"),
City=c("New York", "New York", "San Francisco", "Los Angeles"))
df3 <- data.frame(State=c("New York", "California"),
`State Population`=c(39.24e9, 8.468e9),
check.names=FALSE)
mergeAllXY(df1, df3, df2)
df4 <- data.frame(check.names=FALSE,
CellLine=rep(c("ul3", "dH1A", "dH1B"), each=2),
Treatment=c("Vehicle", "Dex"))
df4$CellLine <- factor(df4$CellLine,
levels=c("ul3", "dH1A", "dH1B"))
df4$Treatment <- factor(df4$Treatment,
levels=c("Vehicle", "Dex"))
df5 <- data.frame(
Treatment=rep(c("Vehicle", "Dex"), each=3),
Time=c("0h", "12h", "24h"))
df6 <- data.frame(check.names=FALSE,
CellLine=c("ul3", "dH1A", "dH1B"),
Type=c("Control", "KO", "KO"))
mergeAllXY(df4, df5, df6)
# note the factor order is maintained
mergeAllXY(df4, df5, df6)$CellLine
mergeAllXY(df4, df5)$Treatment
# merge "all" can append rows to a data.frame
df4b <- data.frame(check.names=FALSE,
CellLine=rep("dH1C", 2),
Treatment=c("Vehicle", "Dex"))
mergeAllXY(df4, df4b)
# factor order is maintained, new levels are appended
mergeAllXY(df4, df4b)$CellLine
# merge proceeds except shows missing data
mergeAllXY(df4, df4b, df5, df6)
# note that appending rows is tricky, the following is incorrect
df6b <- data.frame(check.names=FALSE,
CellLine="dH1C",
Type="KO")
mergeAllXY(df4, df4b, df5, df6, df6b)
# but it can be resolved by merging df6 and df6b
mergeAllXY(df4, df4b, df5, mergeAllXY(df6, df6b))
# it may be easier to recognize by sorting with mixedSortDF()
mixedSortDF(honorFactor=TRUE,
mergeAllXY(df4, df4b, df5, mergeAllXY(df6, df6b)))
# again, factor order is maintained
mergeAllXY(df4, df4b, df5, sort=FALSE, mergeAllXY(df6, df6b))$CellLine
# the result can be sorted properly
mixedSortDF(honorFactor=TRUE,
mergeAllXY(df4, df4b, df5, mergeAllXY(df6, df6b)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.