Kenneth Roy Cabrera Torres
2009-Mar-23 22:04 UTC
[R] [Fwd: Re: Graphic with several curves]
--------- Mensaje reenviado --------> De: Kenneth Roy Cabrera Torres <krcabrer at une.net.co> > Para: CE.KA <ce.kaya75 at yahoo.fr> > Asunto: Re: [R] Graphic with several curves > Fecha: Mon, 23 Mar 2009 17:02:48 -0500 > > try matplot(), > > but you have to transpose the matrix > > with option type="l". > > Example: > > data1<-data.frame(X1990=c(5,15,3,20,10),X1991=c(20,1,14,8,3),X1992=c(6,11,22,55,14)) > data2<-t(data1) > matplot(as.integer(substring(row.names(data2),2)),data2,type="l") > > Data frames names cannot start with a number. R change it to an X, > then when you transpose I obtain the substring with the number that I > need. > > Hope, this helps (HTH) > > Kenneth > > > > > > El lun, 23-03-2009 a las 14:33 -0700, CE.KA escribi?: > > Hi R users, > > > > Imagine the folowing data frame > > 1990 1991 1992 > > 1 5 20 6 > > 2 15 1 11 > > 3 3 14 22 > > 4 20 8 55 > > 5 10 3 14 > > > > Is there a way to build a graphic in which: > > - 1 curve represents the observation 1 during 1990 & 1992 > > - 1 curve represents the observation 2 during 1990 & 1992 > > - 1 curve represents the observation 3 during 1990 & 1992 > > - 1 curve represents the observation 4 during 1990 & 1992 > > - 1 curve represents the observation 5 during 1990 & 1992 > > > > Sincerely yours