sigLabsDT: sigLabsDT

Description Usage Arguments Details Value Author(s) Examples

View source: R/set.sigLabs.R

Description

Set significant labels of multi comparisons with given data.

Usage

1
2
3
4
5
6
7
sigLabsDT(
  dt,
  col.data = 1:ncol(dt),
  col.labels = NULL,
  group.by = NULL,
  stat.vals = FALSE
)

Arguments

dt

data.frame. Support data of both long and short format.

col.data

column indices or names for data. If only one column, the data.frame is treated as long format; otherwise the data.frame should be short format.

col.labels

column indices or names for labels.

group.by

column name or index for grouping. If set, siglabs will be set independently for each group.

stat.vals

TRUE/FALSE(default). If FALSE (typically for short format data), return significant labels (vector) only; otherwise, return a data.frame.

Details

1. get t-test p-value table of pairwise compairison; 2. set siglabs with function sigLabsPT.

Value

string vector of significant letter

Author(s)

ZG Zhao

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
library("Xtools")
dt <- read.csv(file.path(path.package("Xtools"), "data", "data.measure.csv"))
str(dt)
dx <- sigLabsDT(dt, col.data=4:7, group.by="Plant", stat.vals=TRUE)
dx
library("ggplot2")
px <- ggplot(dx, aes(x=Leaf, y=mean, fill=Treat)) + theme_bw(base_size = 16)
px + geom_bar(stat="identity", position=position_dodge(.9), width=0.8, color="gray20") +
  geom_errorbar(aes(ymin=mean - sd, ymax=mean + sd), position = position_dodge(.9), width=0.5) +
  geom_text(aes(y=mean + sd + offset, label=siglabs), position=position_dodge(.9), size=5) +
  scale_y_continuous(expand = c(0, 0)) + geom_blank(aes(y = (mean + sd) * 1.15)) +
  facet_wrap(~Plant, nrow=1)

zgzhao/Xtools documentation built on May 22, 2021, 3:37 a.m.