createColoredBarGraphLabels: splitCol

Description Usage Arguments Examples

Description

This function splits the given column in the data.frame

Usage

1
2
createColoredBarGraphLabels(data, col.x, col.fill, col.facet = NULL,
  middle = TRUE, reverse = TRUE)

Arguments

data

a data frame one of its columns to be split

col.x

the column name used on x aes

col.fill

the column name used for fill/color aes

col.facet

the column name used for facet aes

middle

create the pos to be in the middle. defaults TRUE

reverse

create the pos on reverse. defaults TRUE

Examples

1
2
3
4
5
6
infert$c <- factor(infert$induced)
texts <-  createColoredBarGraphLabels(infert, 'education', 'c')
p <- ggplot(infert, aes(education, fill=c)) + geom_bar(alpha=.9)
p     
p + geom_text(data=texts, aes(y=pos, label=cnt))    
p + geom_text(data=texts, aes(y=pos, label=goodNum(100*cnt/tot, percent=TRUE)))    

etabari/ehsanr documentation built on Aug. 5, 2019, 4:07 p.m.