Dendro: Compare Groups Based on Dendrogram

Description Usage Arguments Value Author(s) Examples

View source: R/statVisual.R

Description

Compare groups based on dendrogram. The nodes of the dendrogram will be colored by group.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
Dendro(
    x, 
    group = NULL, 
    xlab = NULL, 
    ylab = NULL, 
    title = NULL, 
    cor.use = "pairwise.complete.obs", 
    cor.method = "pearson", 
    distance = "rawdata", 
    distance.method = "euclidean", 
    hclust.method = "complete", 
    yintercept = NULL, 
    theme_classic = TRUE, 
    addThemeFlag = TRUE,
    ...)

Arguments

x

A data frame. Rows are subjects; Columns are variables describing the subjects.

group

character. The column name of data that indicates the subject groups. The nodes of the dendrogram will be colored by info provided by group.

xlab

x axis label

ylab

y axis label

title

title of the plot

cor.use

character. Indicate which data will be used to compute correlation coefficients. It can take values “everything”, “all.obs”, “complete.obs”, “na.or.complete”, “pairwise.complete.obs”.

cor.method

character. Indicate which type of correlation coefficients will be calculated: “pearson”, “kendall”, “spearman”.

distance

character. Indicate which type of data will be used to calculate distance: “rawdata” (i.e., using raw data to calculate distance), “cor” (i.e., using correlation coefficients as distance), “1-cor” (i.e., using (1-correlation coefficients) as distance), “1-|cor|” (i.e., using (1-|correlation coefficients|) as distance).

distance.method

character. Available when ‘distance = "rawdata"’. Indicate the definition of distance: distance used in calculate dist “rawdata” (i.e., using raw data to calculate distance), “cor” (i.e., using correlation coefficients as distance), “1-cor” (i.e., using (1-correlation coefficients) as distance), “1-|cor|” (i.e., using (1-|correlation coefficients|) as distance).

hclust.method

character. Indicate which agglomeration method will be used to perform hierarchical clustering. This should be (an unambiguous abbreviation of) one of “ward.D”, “ward.D2”, “single”, “complete”, “average”, “mcquitty”, “median”, or “centroid”. Please refer to hclust.

yintercept

numeric. A line indicating the height of the dendrogram, for example, indicating where the dendrogram should be cut to obtain clusters.

theme_classic

logical. Use classic background without grids (default: TRUE).

addThemeFlag

logical. Indicates if light blue background and white grid should be added to the figure.

...

other input parameters for facet & theme

Value

A list with 9 elements. data, layers, scales, mapping, theme, coordinates, facet plot_env, and labels.

Author(s)

Wenfei Zhang <Wenfei.Zhang@sanofi.com>, Weiliang Qiu <Weiliang.Qiu@sanofi.com>, Xuan Lin <Xuan.Lin@sanofi.com>, Donghui Zhang <Donghui.Zhang@sanofi.com>

Examples

 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
30
31
32
33
34
35
36
37
38
39
40
data(esSim)
print(esSim)

# expression data
dat = exprs(esSim)
print(dim(dat))
print(dat[1:2,])

# phenotype data
pDat = pData(esSim)
print(dim(pDat))
print(pDat[1:2,])

# feature data
fDat = fData(esSim)
print(dim(fDat))
print(fDat[1:2,])

# choose the first 6 probes (3 OE probes, 2 UE probes, and 1 NE probe)
pDat$probe1 = dat[1,]
pDat$probe2 = dat[2,]
pDat$probe3 = dat[3,]
pDat$probe4 = dat[4,]
pDat$probe5 = dat[5,]
pDat$probe6 = dat[6,]

print(pDat[1:2, ])

# check histograms of probe 1 expression in cases and controls
print(table(pDat$grp, useNA = "ifany"))

pDat$grp = factor(pDat$grp)

statVisual(type = 'Dendro', 
           x = pDat[, c(3:8)], 
           group = pDat$grp)

Dendro(
       x = pDat[, c(3:8)], 
       group = pDat$grp)

statVisual documentation built on Feb. 21, 2020, 1:08 a.m.