[R] Mosaic

Sam Thomas sam.thomas at revelanttech.com
Wed Mar 24 19:32:23 CET 2010


I've typically used mosaic plots with categorical data - not sure what the numerical values represent.  

This fits a mosaic plot by rounding the values:  

library(vcd)
t <- xtabs(resp ~ sexo + regiao + ano, data = dados)
ft <- ftable(round(t))

cotabplot(ft, panel = cotab_coindep, type = "mosaic")



Sam Thomas

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Silvano
Sent: Wednesday, March 24, 2010 11:01 AM
To: r-help at r-project.org
Subject: [R] Mosaic

Hi,

I have this data set:

obitoss = c(
5.8,17.4,5.9,17.6,5.8,17.5,4.7,15.8,
3.8,13.4,3.8,13.5,3.7,13.4,3.4,13.6,
4.4,17.3,4.3,17.4,4.2,17.5,4.3,17.0,
4.4,13.6,5.1,14.6,5.7,13.5,3.6,13.3,
6.5,19.6,6.4,19.4,6.3,19.5,6.0,19.7)

(dados = data.frame(
regiao = factor(rep(c('Norte', 'Nordeste', 'Sudeste', 'Sul',
'Centro-Oeste'), each=8)),
ano = factor(rep(c('2000','2001','2002','2003'), each=2)),
sexo = factor(rep(c('F','M'), 4)), resp=obitoss))

I would like to make a mosaic to represent the numeric
variable depending on 3 variables. Does anyone know how to
do?

--------------------------------------
Silvano Cesar da Costa
Departamento de Estatística
Universidade Estadual de Londrina
Fone: 3371-4346

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list