I would like to create a simple mosaic plot from the data file below:
Country|Name|Count
US|Sam|10
US|John|30
UK|Sam|30
UK|John|2
CA|Sam|23
CA|Bill|45
I expect to get a mosaic plot with 1st column on x-axis and stacked rectangle of height "Count" for each category "Name".
I tried:
data<-read.table("my_table.txt", header=T, sep="|")
mosaicplot(data)
But it creates a monster with way too many columns and rows.
My question is how to mention that values of the "Count" variable should be the y values?
I tried to use ftable(graph)
before making the mosaic but even the table is not well ordered.