-5

I have a data table with two small columns.

I want to do a pairwise comparison between the values. The first column is results of one test and the second of another test. So I want a barplot where the first pair of bars show value [1,1] and next to it [1,2] then [1,2] besides [2,2] and so on.

I have 20 values (10 in each from 10 instances) and want 20 bars in one plot. I have no category variable but I want to preserve the order in which they appear in the column (each result corrosponds to an instance). Hence 20 values represented by 20 bars.

Hope you can help.

Edit: Sry for the bad explanation.

Knirke
  • 1
  • 2

1 Answers1

0

Based on your vague question I think this is what you want. Here is a quick example you can use to get your results:

counts <- table(mtcars$vs, mtcars$gear)
barplot(counts, main="Car Distribution by Gears and VS",
        xlab="Number of Gears", col=c("darkblue","red"),
        legend = rownames(counts), beside=TRUE)

enter image description here

Source: http://www.statmethods.net/graphs/bar.html

mlegge
  • 6,763
  • 3
  • 40
  • 67
  • Thank you. I already looked at that example but I do not want to count the occurrences but want a bar for each value. Sorry for the bad explanation – Knirke Feb 11 '15 at 09:09