Exemples :
1. x<-seq(0,10,1)
2. y<-2+3*x
3. profit<-0.3*y-x
4. df<-data.frame(Effort=x, Ventes=y, Profit=profit)
5. y<-2+4*x
6. profit<-0.3*y-x
7. df$Ventes2=y
8. df$Profit2=profit
9. df
10. # show Ventes
11. matplot(x, df[,seq(2,5,2)], pch = 1:2, type = "o", col = 1:2,xlab="Effort", ylab="Reponse")
12. legend(min(x), max(df[,seq(2,5,2)]),names(df)[seq(2,5,2)], lwd=3, col=1:2, pch=1:2)
13. # show Profits
14. matplot(x, df[,seq(3,5,2)], pch = 1:2, type = "o", col = 1:2,xlab="Effort", ylab="Reponse")
15. legend(min(x), max(df[,seq(3,5,2)]),names(df)[seq(3,5,2)], lwd=3, col=1:2, pch=1:2)
Effort Ventes Profit Ventes2 Profit2
1 0 2 0.6 2 0.6
2 1 5 0.5 6 0.8
3 2 8 0.4 10 1.0
4 3 11 0.3 14 1.2
5 4 14 0.2 18 1.4
6 5 17 0.1 22 1.6
7 6 20 0.0 26 1.8
8 7 23 -0.1 30 2.0
9 8 26 -0.2 34 2.2
10 9 29 -0.3 38 2.4
11 10 32 -0.4 42 2.6