Re: [R] Multiline and grouping in R

From: Jim Lemon <>
Date: Wed, 30 Jun 2010 21:33:00 +1000

On 06/30/2010 10:42 AM, Pablo Cerdeira wrote:
> Hi All,
> this is my first mail here.
> I'm trying to plot a multiline chart grouping values with no success. I have
> read a lot in the official Wiki and also searched via Google, but I did not
> find anything.
> I'm importing some data from a cvs file. Here is a sample:
> 1988,CONTRACTS,286
> 1988,FAMILY,385
> 1988,TAXATION,177
> 1989,CONTRACTS,233
> 1989,FAMILY,425
> 1989,TAXATION,201
> 1990,CONTRACTS,190
> 1990,FAMILY,303
> 1990,TAXATION,209
> ...
> "t<- read.csv("file.csv", header=TRUE)"
> So far so good...
> But the problem is: I'd like to create a multiline plot, one line per AREA,
> showing the evolution of the number of CASES per YEAR.
Hi Pablo,
Just to give you another option, if your data frame is "pcdf":

newpcmat<-cbind(pcdf$CASES[pcdf$YEAR==1988],   pcdf$CASES[pcdf$YEAR==1989],
colnames(newpcmat)<-c("1988","1989","1990") rownames(newpcdf)<-c("CONTRACTS","INTERNATIONAL","FAMILY","TAXATION") bumpchart(newpcmat,col=1:4,rank=FALSE,
  main="Number of cases by year")

Jim mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Wed 30 Jun 2010 - 11:30:24 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 30 Jun 2010 - 12:20:44 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive