I'm currently learning R and ggplot2, but have encountered an issue I have no clue how to solve. I have a tidied dataset resembling the one in the picture (1). I'd like to plot the X entries against the Y entries in a scatterplot, so the 3 points would be: (1, 4), (2, 5), (3, 6).
The workaround I have so far is the following:
x <- tab %>% filter(Var == "X")
y <- tab %>% filter(Var == "Y")
plot(x ~ y)
This gives the plot I want, but I'd like to find a way to do it with ggplot if this is possible. Is this a problem with the way I apply the functions and formula or with the way my data is formatted for this case? Thank you greatly in advance, I'm very new to SO so apologies if my formatting is off.