Monthly Archives: febrero 2016

You are browsing the site archives by month.

The companion density plot

library(dplyr)
glimpse(faithful)
## Observations: 272
## Variables: 2
## $ eruptions (dbl) 3.600, 1.800, 3.333, 2.283, 4.533, 2.883, 4.700, 3.6...
## $ waiting   (dbl) 79, 54, 74, 62, 85, 55, 88, 85, 51, 85, 54, 84, 78, ...
head(faithful)
##   eruptions waiting
## 1     3.600      79
## 2     1.800      54
## 3     3.333      74
## 4     2.283      62
## 5     4.533      85
## 6     2.883      55
d <- density(faithful$waiting) 
plot(d, main = "") 

plot of chunk unnamed-chunk-3

The ingenious box plot

library(vcd)
class(Arthritis)
## [1] "data.frame"
head(Arthritis)
##   ID Treatment  Sex Age Improved
## 1 57   Treated Male  27     Some
## 2 46   Treated Male  29     None
## 3 77   Treated Male  30     None
## 4 17   Treated Male  32   Marked
## 5 36   Treated Male  46   Marked
## 6 23   Treated Male  58   Marked
boxplot(Age ~ Improved, data=Arthritis, ylab="Age", xlab="Improved")

plot of chunk unnamed-chunk-3

The simple bar graph

library(vcdExtra)
class(Depends)
## [1] "table"
head(Depends)
## Depends
##    0    1    2    3    4    5 
##  986 1347  993  685  375  298
plot(Depends)

plot of chunk unnamed-chunk-3

The humble scatter plot

library(dplyr)
class(cars)
## [1] "data.frame"
glimpse(cars)
## Observations: 50
## Variables: 2
## $ speed (dbl) 4, 4, 7, 7, 8, 9, 10, 10, 10, 11, 11, 12, 12, 12, 12, 13...
## $ dist  (dbl) 2, 10, 4, 22, 16, 10, 18, 26, 34, 17, 28, 14, 20, 24, 28...
plot(cars)

plot of chunk unnamed-chunk-2

The story teller line graph

class(airmiles)
## [1] "ts"
head(airmiles)
## [1]  412  480  683 1052 1385 1418
plot(airmiles)

plot of chunk unnamed-chunk-1

The revealing stem and leaf chart

library(dplyr)
glimpse(beaver2)
## Observations: 100
## Variables: 4
## $ day   (dbl) 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 3...
## $ time  (dbl) 930, 940, 950, 1000, 1010, 1020, 1030, 1040, 1050, 1100,...
## $ temp  (dbl) 36.58, 36.73, 36.93, 37.15, 37.23, 37.24, 37.24, 36.90, ...
## $ activ (dbl) 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,...
stem(beaver2$temp)
## 
##   The decimal point is 1 digit(s) to the left of the |
## 
##   364 | 8
##   366 | 3
##   368 | 90035577899
##   370 | 0114472223445577
##   372 | 34488
##   374 | 14661156
##   376 | 03444013456666678
##   378 | 1234446691255668
##   380 | 011122344670011557899
##   382 | 4455

The charming histogram

library(dplyr)
glimpse(faithful)
## Observations: 272
## Variables: 2
## $ eruptions (dbl) 3.600, 1.800, 3.333, 2.283, 4.533, 2.883, 4.700, 3.6...
## $ waiting   (dbl) 79, 54, 74, 62, 85, 55, 88, 85, 51, 85, 54, 84, 78, ...
hist(faithful$waiting, 
     xlab = "Waiting time", 
     main = "")

plot of chunk unnamed-chunk-2

Discrete Data Analysis with R

I’m really proud of having collaborate solving LaTeX formatting issues of this awesome book:

Discrete Data Analysis with R: Visualization and Modeling Techniques for Categorical and Count Data. Michael Friendly and David Meyer. Chapman & Hall/CRC Texts in Statistical Science
https://www.crcpress.com/Discrete-Data-Analysis-with-R-Visualization-and-Modeling-Techniques-for/Friendly-Meyer/9781498725835

A talk about ggplot2

On 23rd November I gave a talk about ggplot2 at York University. Here is the link of this talk: http://qm.info.yorku.ca/event/quantitative-methods-forum-12/?instance_id=983 and here are the slides: ggplot2_talk

One more shiny test