## ----include=FALSE------------------------------------------------------------ suppressPackageStartupMessages(library("lessR")) ## ----include=FALSE------------------------------------------------------------ knitr::opts_chunk$set(fig.width=5.5, fig.height=4) ## ----read--------------------------------------------------------------------- d <- Read("Employee") ## ----bc1, dataTable, echo=FALSE, out.width='30%', fig.asp=.7, fig.align='center', out.extra='style="border-style: none"'---- knitr::include_graphics(system.file("img", "bcExplain.png", package="lessR")) ## ----bcEx, fig.width=4, fig.height=3.5, fig.align='center', fig.cap="Bar chart of tablulated counts of employees in each department."---- Chart(Dept) ## ----echo=FALSE------------------------------------------------------------------------------------------------------- style(quiet=TRUE) ## ----echo=FALSE, include=FALSE---------------------------------------------------------------------------------------- d <- Read("Employee") ## ----pc1, eval=FALSE-------------------------------------------------------------------------------------------------- # Chart(Dept, type="pie") ## ----pc1run, echo=FALSE, fig.align='center', fig.width=3.5, fig.height=3.5-------------------------------------------- p <- Chart(Dept, type="pie") p ## ----hole0, eval=FALSE------------------------------------------------------------------------------------------------ # Chart(Dept, hole=0, type="pie") ## ----hole0run, echo=FALSE, fig.width=3.5, fig.height=3.5, fig.align='center', fig.cap="Standard pie chart of variable Dept in the _d_ data frame."---- p <- Chart(Dept, hole=0, type="pie") p ## ----egTM, eval=FALSE------------------------------------------------------------------------------------------------- # Chart(Dept, type="treemap") ## ----egTMrun, echo=FALSE, fig.cap="Treemap of count of the number of employees in each department."------------------- p <- Chart(Dept, type="treemap") p ## ----egIce, eval=FALSE------------------------------------------------------------------------------------------------ # Chart(Dept, type="icicle") ## ----egIceRun, echo=FALSE, fig.cap="Icicle chart of count of the number of employees in each department."------------- p <- Chart(Dept, type="icicle") p ## ----egRadar, eval=FALSE---------------------------------------------------------------------------------------------- # Chart(Dept, type="radar") ## ----radarEx, echo=FALSE, fig.cap="Radar chart of the count of the number of employees in each department."----------- p <- Chart(Dept, type="radar") p ## ----bubEx, echo=FALSE, fig.cap="Bubble chart of the count of the number of employees in each department."------------ p <- Chart(Dept, type="bubble") p ## ----a---------------------------------------------------------------------------------------------------------------- a <- pivot(d, mean, Salary, Dept) a ## ----bcXY, dataTable, echo=FALSE, out.width='35%', fig.asp=.7, fig.align='center', out.extra='style="border-style: none"'---- knitr::include_graphics(system.file("img", "bcXYExplain.png", package="lessR")) ## ----xy, fig.width=4, fig.height=3.5, fig.align='center'-------------------------------------------------------------- Chart(Dept, y=Salary_mean, data=a) ## ----fig.width=4, fig.height=3.5, fig.align='center'------------------------------------------------------------------ Chart(Dept, y=Salary, stat="dev", sort="+", fill_split=0) ## ----fig.width=4, fig.height=3.5, fig.align='center'------------------------------------------------------------------ Chart(Dept, y=Salary, stat="deviation", sort="+", fill_scaled=TRUE, fill=c("red", "blue")) ## ----barstack, fig.width=6, fig.height=5.5, fig.align='center'-------------------------------------------------------- d <- Read("Mach4", quiet=TRUE) Chart(m01:m20, horiz=TRUE, labels="off", sort="+") ## ----BPFM, fig.width=6, fig.height=10.5, fig.align='center'----------------------------------------------------------- Chart(m01:m20, type="bubble") ## ----bc2var, dataTable, echo=FALSE, out.width='34%', fig.asp=.7, fig.align='center', out.extra='style="border-style: none"'---- knitr::include_graphics(system.file("img", "bcXYExplain.png", package="lessR")) ## ----echo=FALSE, include=FALSE---------------------------------------------------------------------------------------- d <- Read("Employee") ## ----fig.width=4, fig.align='center'---------------------------------------------------------------------------------- Chart(Dept, by=Gender) ## ----echo=FALSE, include=FALSE---------------------------------------------------------------------------------------- d <- Read("Employee") ## ----sun1, eval=FALSE------------------------------------------------------------------------------------------------- # Chart(Dept, by=Gender, type="pie") ## ----sun1run, echo=FALSE, fig.align='center', fig.width=3.5, fig.height=3.5------------------------------------------- p <- Chart(Dept, by=Gender, type="pie") p ## ----sun1by, eval=FALSE----------------------------------------------------------------------------------------------- # Chart(Dept, by=c(Gender, Plan), type="pie") ## ----sun1runby, echo=FALSE, fig.align='center', fig.width=3.5, fig.height=3.5----------------------------------------- p <- Chart(Dept, by=c(Gender, Plan), type="pie") p ## ----egTM2, eval=FALSE, fig.cap="Treemap of count of the number of employees in each department."--------------------- # Chart(Dept, by=Gender, type="treemap") ## ----egTMrun2, echo=FALSE, fig.cap="Treemap of count of the number of employees in each department."------------------ p <- Chart(Dept, by=Gender, type="treemap") p ## ----egIce2, eval=FALSE, fig.cap="Icicle chart of count of the number of employees in each department."--------------- # Chart(Dept, by=Gender, type="icicle") ## ----egIceRun2, echo=FALSE, fig.cap="Icicle chart of count of the number of employees in each department."------------ p <- Chart(Dept, by=Gender, type="icicle") p ## ----radarExby, echo=TRUE--------------------------------------------------------------------------------------------- p <- Chart(Dept, by=Gender, type="radar") p ## ----bubExby, echo=TRUE, fig.height=3--------------------------------------------------------------------------------- p <- Chart(Dept, by=Gender, type="bubble") p ## ----dotEx, echo=TRUE, fig.height=3----------------------------------------------------------------------------------- p <- Chart(Dept, type="dot") p ## ----dot2Exby, echo=TRUE, fig.height=3-------------------------------------------------------------------------------- p <- Chart(Dept, y=c(Pre, Post), stat="mean", origin_x=70, type="dot") p ## ----fig.width=4, fig.align='center'---------------------------------------------------------------------------------- Chart(Dept, facet=Gender) ## ----fig.align='center'----------------------------------------------------------------------------------------------- Chart(Dept, facet=Gender, n_col=1) ## ----fig.width=4, fig.align='center'---------------------------------------------------------------------------------- Chart(Dept, by=Gender, stack100=TRUE) ## --------------------------------------------------------------------------------------------------------------------- d <- rd("Mach4", quiet=TRUE) ## --------------------------------------------------------------------------------------------------------------------- l <- rd("Mach4_lbl", quiet=TRUE) ## --------------------------------------------------------------------------------------------------------------------- LikertCats <- c("Strongly Disagree", "Disagree", "Slightly Disagree", "Slightly Agree", "Agree", "Strongly Agree") d <- factors(c(m06,m07,m09,m10), levels=0:5, labels=LikertCats, ordered=TRUE) ## ----fig.width=6, fig.height=4.5, fig.align='center'------------------------------------------------------------------ Chart(m06, by=m07, quiet=FALSE) ## ----echo=FALSE, include=FALSE---------------------------------------------------------------------------------------- d <- Read("Employee") ## ----fig.width=4, fig.height=3.75, fig.align='center'----------------------------------------------------------------- Chart(Dept, fill="darkred", color="black", transparency=.8, labels_color="black") ## ----fig.width=4, fig.height=3.5, fig.align='center'------------------------------------------------------------------ Chart(Dept, theme="gray", labels="off", horiz=TRUE) ## ----fig.width=4, fig.height=3.5, fig.align='center'------------------------------------------------------------------ Chart(Dept, fill="reds") ## ----fig.width=4, fig.height=3.5, fig.align='center'------------------------------------------------------------------ Chart(Dept, fill="viridis") ## ----fig.width=4, fig.height=3.5, fig.align='center'------------------------------------------------------------------ Chart(Dept, fill="GrandBudapest1") ## ----fig.width=4, fig.height=3.5, fig.align='center'------------------------------------------------------------------ Chart(Dept, fill=(count)) ## ----fig.width=4, fig.height=3.5, fig.align='center'------------------------------------------------------------------ Chart(Dept, rotate_x=45, offset=1, sort="-") ## ----fig.width=4, fig.height=3.5, fig.align='center'------------------------------------------------------------------ Chart(Dept, axis_fmt=",", axis_y_pre="£") ## ----fig.width=5, fig.align='center'---------------------------------------------------------------------------------- Chart(Dept, by=Gender, beside=TRUE, labels_position="out") ## ----fig.width=6------------------------------------------------------------------------------------------------------ Chart(Gender, by=Dept, horiz=TRUE) ## ----fig.width=4, fig.align='center'---------------------------------------------------------------------------------- Chart(Dept, by=Gender, fill=c("deepskyblue", "black")) ## ----fig.width=4, fig.height=3.5, fig.align='center'------------------------------------------------------------------ d <- Read("Employee", quiet=TRUE) style(add_fill="aliceblue") Chart(Dept, add=c("rect", "Employees by\nDepartment"), x1=c(1.75,3), y1=c(11, 10), x2=4.25, y2=9) ## ----labels----------------------------------------------------------------------------------------------------------- l <- rd("Employee_lbl") l ## ----f1--------------------------------------------------------------------------------------------------------------- Chart(Dept, filter=(Gender=="W")) ## ----f1hr2------------------------------------------------------------------------------------------------------------ Chart(Dept, filter=c(1:5, 20,21))