Q:

How to plot different series with different colors in R?

Given the following data:
data =

1 2.3
1 3.4
1 2.1
2 4.3
2 5.3
2 6.2
3 0.2
3 0.3
3 0.4

I need to plot these data as 3 different series: 

1st curve: when the 1st column is equal to 1
2nd curve: when the 2nd column is equal to 2
3rd curve: when the 3rd column is equal to 3

How can I do this in the most flexible way (using different colors)?

A:

In this solution I assume that your first column is your grouping variable; the second column the variable that you'd like in the Y-axis. I added a variable x for the time-series.
Data
df<-data.frame(v1=as.factor(c(1,1,1,2,2,2,3,3,3)), v2=as.numeric(c(2.3, 3.4, 2.1, 4.3, 5.3, 6.2, 0.2, 0.3, 0.4)))

df$x<-c(1,2,3,1,2,3,1,2,3)

ggplot
library(ggplot2)

ggplot(df, aes(x,v2, group=v1, colour=v1)) + geom_line()

