Stacked Bar Chart in R
Thank you for providing a good reproducible code, I can't resist answering the question :)
Hope the following code helps:
data &lt;- read.table(text = &quot;0    1   2   3   4   5
MR  155 211 64  14  1   1
Mob 0   393 51  2   0   0
SC  0   427 12  7   0   0
Act 0   386 45  15  0   0
Pain    0   379 62  5   0   0
Anx 0   355 73  18  0   0&quot;, header = TRUE)

#data$row &lt;- seq_len(nrow(data))
data$row &lt;- row.names(data)
data2 &lt;- melt(data, id.vars =&quot;row&quot;)
data2$variable &lt;- sub("X",as.character(data2$variable),replacement=&quot;&quot;,fixed=TRUE)

ggplot(data2, aes(x = variable, y = value, fill = row)) + 
  geom_bar(stat = &quot;identity&quot;) +
  xlab(&quot;HealthState&quot;) +
  ylab(&quot;Count&quot;) +
  theme_bw()