take the following as a simple example:
A <- c(1,1,1,2,2,3,3,4,4,4)
B <- c(1,0,0,1,0,1,0,1,0,0)
C <- c(6,3,2,4,1,2,6,8,4,3)
data <- data.frame(A,B,C)
data
I want to create a scatterplot that looks like so: without the blue and red boarders, they are there as an explanitary guide
So I want to plot: Each time B=1, I want to use its C value for the horizontal scale and plot the C value where B=0 along the vertical scale.
So for example; where X=6
, we have points at x=3 and 2
where X=4
, we have points at x=1
where X=2
, we have a point at x=6
where X=8
, we have a points at x=4 and 3
Must i manipuulate/melt/reshape my data somehow?