combine.data.frame: merge dataframes

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/DataFormat_Utils.R

Description

combine.data.frame merges two dataframes, completing the rows and columns that are not shared by the dataframes.

Usage

1
2
combine.data.frame(df1, df2, fill=NA, merge.cols=TRUE, 
  original_rowName.col=TRUE, merge.rows="df1")

Arguments

df1

a dataframe

df2

a dataframe

fill

character or NA. A value to put into the cells that have no data. Default NA

merge.cols

logical. Merge colomns with common name. Default TRUE

original_rowName.col

logical. if TRUE, add a column with the original rownames. Default TRUE

merge.rows

character. If the data.frames df1 and df2 have common rows, the values for these rows of this dataset must be kept in favor of the other. If NA, both rows will be kept. Either "df1", "df2" or NA. Default "df1"

Details

Columns with matching names can or cannot be merged, rows are automatically bound (a wrapper of rbind), not merged. Any missing data as a result of the non-matchng columns will be filled by the fill argument.

Value

a data.frame

Author(s)

Maxime Sweetlove

See Also

Other formating functions: combine.data(), eMoF.to.wideTable(), wideTab.to.hierarchicalTab(), wideTable.to.eMoF()

Examples

1
2
3
4
df01 <- data.frame(var1=1:4, var2=2:5, row.names=paste("r", 1:4, sep=""))
df02 <- data.frame(var1=5:8, var3=1:4, row.names=paste("t", 1:4, sep=""))
combine.data.frame(df1=df01, df2=df02, fill=NA, merge.cols=TRUE, 
                   original_rowName.col=TRUE, merge.rows="df1")

biodiversity-aq/OmicsMetaData documentation built on Dec. 19, 2021, 9:44 a.m.