library(lessR)
## 
## lessR 3.7.5     feedback: gerbing@pdx.edu     web: lessRstats.com/new
## ---------------------------------------------------------------------
## 1. mydata <- Read()        Read text, Excel, SPSS, SAS or R data file
## 2. Help()                  Get help
## 3. hs(), bc(), or ca()     All histograms, all bar charts, or both
## 4. Plot(X) or Plot(X,Y)    For continuous and categorical variables
##                            numerical X: Violin, Box, Scatter plot 
## 5. by1= , by2=             Trellis graphics, a plot for each by1, by2
## 6. reg(Y ~ X, Rmd="eg")    Regression + R markdown file that, when
##                            knit, provides full interpretative output
## 7. style("darkred", sub.theme="colors") Set theme, sub.theme
##    style(show=TRUE)        all color/style options and current values
## 8. getColors()             create discrete, continuous color scales
mydata <- rd("Cars93", format="lessR", quiet=TRUE)

Default color theme

The grays were getting boring. Now a blue complement to the lightbronze background fills in bars, points, and the violin plot, which has a lighter blue fill than the others.

BarChart(Type)

## >>> Suggestions
## Plot(Type)  # bubble plot
## Plot(Type, values="count")  # lollipop plot
## BarChart(Type, horiz=TRUE)  # horizontal bar chart
## BarChart(Type, fill="colors", color="off")  # hcl bar colors
## PieChart(Type)  # doughnut chart 
## 
## 
## --- Type ---
## 
## 
## Missing Values of Type: 0 
## 
## 
##                Compact  Large  Midsize  Small  Sporty    Van    Total 
## Frequencies:        16     11       22     21      14      9       93 
## Proportions:     0.172  0.118    0.237  0.226   0.151  0.097    1.000 
## 
## 
## Chi-squared test of null hypothesis of equal probabilities 
##   Chisq = 8.871, df = 5, p-value = 0.114
Plot(MPGcity)
## [Violin/Box/Scatterplot graphics from Deepayan Sarkar's lattice package]
## >>> Suggestions
## Plot(MPGcity, out.cut=2, fences=TRUE, vbs.mean=TRUE)  # Label two outliers ...
## Plot(MPGcity, box.adj=TRUE)  # Adjust boxplot whiskers for asymmetry 
## 
## --- MPGcity --- 
## Present: 93 
## Missing: 0 
## Total  : 93 
##  
## Mean         : 22.37 
## Stnd Dev     : 5.62 
## IQR          : 7.00 
## Skew         : 0.20   [medcouple, -1 to 1] 
##  
## Minimum      : 15.00 
## Lower Whisker: 15.00 
## 1st Quartile : 18.00 
## Median       : 21.00 
## 3rd Quartile : 25.00 
## Upper Whisker: 33.00 
## Maximum      : 46.00 
## 
## 
## (Box plot) Outliers: 3 
##  
## Small      Large 
## -----      ----- 
##            39 46.0 
##            42 42.0 
##            83 39.0 
## 
## 
##         Max Dupli- 
## Level    cations   Values 
## ------------------------------ 
## MPGcity     12     18 
## 
## 
## Parameter values (can be manually set) 
## ------------------------------------------------------- 
## size: 0.57      size of plotted points 
## jitter.y: 1.38  random vertical movement of points 
## jitter.x: 0.33  random horizontal movement of points 
## bw: 3.36     set bandwidth higher for smoother edges

Improved Margins

Much better control of margins, including when rotate.x is set to 90 (perpendicular to axis). Also when the text output becomes too wide, horizontal width of the console the output realigns to vertical, which can also be set manually with out.size, the number of characters in a line before display the frequency distribution vertically.

BarChart(Make, rotate.x=90)

## >>> Suggestions
## Plot(Make)  # bubble plot
## Plot(Make, values="count")  # lollipop plot
## BarChart(Make, horiz=TRUE)  # horizontal bar chart
## BarChart(Make, fill="colors", color="off")  # hcl bar colors
## PieChart(Make)  # doughnut chart 
## 
## 
## --- Make ---
## 
## 
## Missing Values of Make: 0 
## 
## 
##          Make Count   Prop 
## -------------------------- 
##         Acura    2   0.022 
##          Audi    2   0.022 
##           BMW    1   0.011 
##         Buick    4   0.043 
##      Cadillac    2   0.022 
##     Chevrolet    8   0.086 
##      Chrylser    1   0.011 
##      Chrysler    2   0.022 
##         Dodge    6   0.065 
##         Eagle    2   0.022 
##          Ford    8   0.086 
##           Geo    2   0.022 
##         Honda    3   0.032 
##       Hyundai    4   0.043 
##      Infiniti    1   0.011 
##         Lexus    2   0.022 
##       Lincoln    2   0.022 
##         Mazda    5   0.054 
## Mercedes-Benz    2   0.022 
##       Mercury    2   0.022 
##    Mitsubishi    2   0.022 
##        Nissan    4   0.043 
##    Oldsmobile    4   0.043 
##      Plymouth    1   0.011 
##       Pontiac    5   0.054 
##          Saab    1   0.011 
##        Saturn    1   0.011 
##        Subaru    3   0.032 
##        Suzuki    1   0.011 
##        Toyota    4   0.043 
##    Volkswagen    4   0.043 
##         Volvo    2   0.022 
## -------------------------- 
##         Total   93   1.000 
## 
## 
## Chi-squared test of null hypothesis of equal probabilities 
##   Chisq = 38.785, df = 31, p-value = 0.159 
## >>> Low cell expected frequencies, so chi-squared approximation may not be accurate 
## 

Moving the category axis to horizontal jams the axis values. One solution is to raise the vertical height of the plot.

style(quiet=TRUE)
BarChart(Make, horiz=TRUE)