UtilsCombine: Utils to combine data frames or matrices into the required...

Usage Arguments Details Examples

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
getTriMatrix(df, row.col = c("l1", "l2"), value = "corr", na.to.0 = TRUE,
  order.by = c())

combineTriMatrix(tri.m1, tri.m2)

nmdsTriMatrix(tri.m, text.or.point = 1, text.size = 5, text.repel = T,
  title = "NDMS plot", title.add.stress = F, ...)

plotCombinedTriMatrix(tri.m1.m2, label.digits = 3, lower.lim = NA,
  upper.lim = NA, breaks.by = NA, data.levels = c(), high = "#f46d43",
  mid = "#ffffbf", low = "#3288bd", title = "",
  legend.title = "Correlations", ...)

combineTwoDF(dfm, dfm2, rm.zero = TRUE, return.df = TRUE, ...)

mergeBy(x, y, by = "row.names", rm.by = FALSE, warning.msg = TRUE, ...)

mergeListOfDF(df.list, by = "row.names", rm.by = TRUE, suffixes = c(),
  ...)

Arguments

df

The data frame containing pairwised comparison result, such as correlations. For example, a data frame can be

l1 l2 corr sign
16S 18S 0.827 0.001
16S ITS 0.585 0.001
18S ITS 0.729 0.001
value

The column's values are going to fill in the output matrix.

na.to.0

Logical, replace all NA to 0, as default.

order.by

A vector to order matrix rows and columns. It must be a subset or same as their names.

tri.m1, tri.m2

Two symmetric triangular matrices, which can be the output from getTriMatrix.

tri.m

A symmetric triangular matrix from getTriMatrix.

text.or.point, text.size, text.repel, title, title.add.stress, ...

See ggNMDSPlot.

tri.m1.m2

The combined symmetric triangular matrix from combineTriMatrix.

label.digits, data.levels, high, mid, low, title, legend.title, ...

See ggHeatmap.

lower.lim, upper.lim, breaks.by

To configure the legend bar.

dfm

A data frame or matrix.

dfm2

The 2nd data frame or matrix whose values are into brackets.

rm.zero

Default to TRUE to remove all " (0)".

return.df, ...

Default to TRUE to return a data frame, otherwise a matrix.

x, y

data frames, or objects to be coerced to one.

by, ...

Specifications of the column(s) used for merging, and more arguments passed to merge.

rm.by

Logical; if TRUE, then remove the column(s) specified by by after merge. Default to FALSE. But if by="row.names", then copy the column 'Row.names' created by merge into rownames before drop it.

warning.msg

Logical; if TRUE as default, then print warning message if any row is dropped after merge.

df.list

a list of data frames, or objects to be coerced to one.

suffixes

The vector of suffixes added to distinguish colmun names merged by different data frames. Its length must equal to df.list.

key

Two column names containing the pair names, which determine the output matrix's row names and column names. It must make row and column names same.

Details

getTriMatrix converts pairwised comparison result into a symmetric triangular matrix. The pairwised comparison result is stored in a data frame. Two of their columns must have pair names in the same order, which determine the matrix's row names and column names. The 1st data frame goes to the lower triangle of the matrix, and the 2nd is in upper triangle.

combineTriMatrix combines two symmetric triangular matrices into one. The 1st matrix goes to the lower triangle in the combined matrix, and the 2nd to upper triangle.

nmdsTriMatrix makes a NMDS plot for one of symmetric triangular.

plotCombinedTriMatrix plot a heatmap on the combined symmetric triangular matrix.

combineTwoDF combines two data frames or matrices with a same structure in one, put all values in 2nd data frame into brackets.

mergeBy is an improved function of merge by column(s).

mergeListOfDF merges a list of data frames into one using mergeBy.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
corr.tri <- getTriMatrix(corr.df)

corr.sign.tri <- combineTriMatrix(corr.tri, sign.tri)

nmds <- nmdsTriMatrix(corr.tri) + expand_limits(x = c(-1, 1), y=c(-1, 1))

hm <- plotCombinedTriMatrix(corr.sign.tri)

df <- combineTwoDF(df, df2, stringsAsFactors=FALSE)

df <- mergeBy(df, df2)

df <- mergeListOfDF(df.list, suffixes=names(df.list))
df <- mergeListOfDF(df.list, by="gene", suffixes=c("16S","18S","ITS"))

walterxie/ComMA documentation built on May 3, 2019, 11:51 p.m.