First, I want to clarify this is a very basic question. I'm new using R (and programming in general).
I have a data.frame with 3 columns:
block, average condition 1, average condition 2.
The blocks run from 1 to 9 and the average are response times averaged across subjects. What I want to do is to plot both averages, one for each condition, while having in the x axis the progression of blocks. Therefore, I would expect to have one line for each condition running above the x axis.
My question is what plot function should I use. I've tried with nearly everyone but what I thought would serve (simply plotting a vector with two columns as entry, against the block column) doesn't work, it gives the error:
'x' and 'y' lengths differ
So I thought I should first plot only one condition and then somehow add the other line with a second command. I successfully plotted one condition as I wanted to:
plot(meanrts2[,3],meanrts2[,2],ylab="RT",xlab="block",type="l")
So here I'm choosing the 3rd and 2nd columns to do the plotting, but what I want is to have two columns running parallel, each one with different colors.
I tried abline, using the other columns I haven't plotted yet as an argument, but I get the "invalid a=, b= specification"
Any suggestions are very welcome. Any other information I missed you can always ask.