Hi,

I want to draw a pie chart of level (variable) for each ID (variable). I have a big dataset, here I attach part of it.


ID level 
1 G1 
1 A1 
1 A1 
1 G1 
1 G1 
1 G1 
1 A1 
1 A1 
1 G1 
1 G1 
1 G3 
1 A1 
1 G1 
1 A1 
1 A1 
1 A2 
1 A2 
1 M 
1 A1 
1 G1 
1 A1 
1 
 
1 
 
1 A2 
1 G3 
1 A1 
1 A1 
1 A1 
Below is my r code:
level <- na.exclude(level)
level.table <- table(level)
level.sum <- sum(level.table )
lbls <- round(level.table /level.sum*100,1)
lbls <- paste(lbls,"%",sep="")
pie(level.table,labels=lbls,col=rainbow(length(level.table)),radius=0.5,cex=0.9)

The problem is the na.exclude function does not work here. Is it the reason that my missing values are not 'NA's but blank? How can I get the pie chart without those missing values?

Thank you,
Lu


      
	[[alternative HTML version deleted]]

