| fsmry.graph | R Documentation |
Summarize y by x graphically
fsmry.graph(y, x, type = c("scatter", "bxp", "errbar", "bar", "bar2"),
y.plab = "", x.plab = "", ynames = NULL, xnames = NULL,
stat.txt = NULL, loc.stat = NULL, ylim = NULL, fname = NULL,
y.fnlab = NULL, x.fnlab = NULL, subgrp = "", withline = T,
geomean = F, silent = T, width = 3, height = 3, mar = NULL,
mgp = NULL, cex.bar = NULL, cex = 1, ...)
y |
A continuous variable. |
x |
A continuous or categorical variable. |
type |
a text string for the type of graph, e.g., "scatter","bxp","errbar","bar",or "bar2" |
y.plab |
y-axis label |
x.plab |
x-axis label |
ynames |
names for different categories of y |
xnames |
names for different categories of x |
stat.txt |
statistics to show on the graph, typically, p-value and/or correlation coefficient |
loc.stat |
location of the stat.txt |
ylim |
specify the y-axis limit if needed |
fname |
a text string of file name if a win-meta file is to be generated |
y.fnlab |
a text string of y variable name to be included in a file name |
x.fnlab |
a text string of x variable name to be included in a file name |
subgrp |
a text string of analysis cohort name to be included in a file name |
withline |
a logic indicator of whether to include the Tukey line in the scatter plot, default true |
geomean |
a logic indicator of whether to plot geometric mean/sd when plotting the errbar plot, default false |
silent |
a logic indicator of whether to output the mp variable generated by barplot function, default true |
width |
width of the graph is a win-meta file is to be generated |
height |
height of the graph is a win-meta file is to be generated |
mar |
graphical parameter |
mgp |
graphical parameter |
cex.bar |
graphical parameter for specifying text size of text above each bar |
cex |
graphical parameter |
... |
additional graphical paramter |
Summary graph of y by x.
set.seed(16)
dat.work <- data.frame(ht = c(rnorm(10, mean=1.72, sd=0.1), rnorm(10, mean=1.65, sd=0.1)),
wt = c(rnorm(10, mean=70, sd=10), rnorm(10, mean=60, sd=10)),
sex = factor(rep(c("Female", "Male", "Female", "Male"), c(2,8,6,4))),
group = factor(rep(c("grp1", "grp2"), each=10)))
cor.test(dat.work$wt, x = dat.work$ht)
fsmry.graph(y = dat.work$wt, x = dat.work$ht, type ="scatter",
y.plab = "Weight",
x.plab = "Height",
stat.txt = "r=-0.24, p=0.31")
fsmry.by.grp(y = dat.work$ht, grp = dat.work$sex)
fsmry.graph(y = dat.work$ht, x = dat.work$sex, type ="bxp",
y.plab = "Weight",
x.plab = "Sex",
stat.txt = "p=0.68")
fsmry.graph(y = dat.work$ht, x = dat.work$sex, type ="errbar",
y.plab = "Weight",
x.plab = "Sex",
stat.txt = "p=0.66")
fsmry.graph(y = dat.work$ht, x = dat.work$sex, type ="errbar",
y.plab = "Weight",
stat.txt = "p=0.68",
geomean=T)
fsmry2.by.grp(y = dat.work$sex, grp=dat.work$group, cmp.method="fisher")
fsmry.graph(y = dat.work$sex, x = dat.work$group, type ="bar",
stat.txt = "p=0.17")
fsmry.graph(y = dat.work$sex, x = dat.work$group, type ="bar",
xnames=c("Group1", "Group2"),
stat.txt = "p=0.17")
fsmry.graph(y = dat.work$sex, x = dat.work$group, type ="bar2",
xnames=c("Group1", "Group2"),
stat.txt = "p=0.17")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.