library(knitr) ## Set up the size of plots in the output
Wafa Ben RIchard Bold
SD
SD
tips <- read.csv("http://www.ggobi.org/book/data/tips.csv")
summary(tips)
## obs totbill tip sex smoker
## Min. : 1.00 Min. : 3.07 Min. : 1.000 F: 87 No :151
## 1st Qu.: 61.75 1st Qu.:13.35 1st Qu.: 2.000 M:157 Yes: 93
## Median :122.50 Median :17.80 Median : 2.900
## Mean :122.50 Mean :19.79 Mean : 2.998
## 3rd Qu.:183.25 3rd Qu.:24.13 3rd Qu.: 3.562
## Max. :244.00 Max. :50.81 Max. :10.000
## day time size
## Fri:19 Day : 68 Min. :1.00
## Sat:87 Night:176 1st Qu.:2.00
## Sun:76 Median :2.00
## Thu:62 Mean :2.57
## 3rd Qu.:3.00
## Max. :6.00
You can also embed plots, for example:
library(ggplot2)
p<-ggplot(data=tips,aes(smoker,fill=time))
p + geom_bar(width=0.5)
## Set up the size of plots in the output