[R] pie chart

Jim Lemon jim at bitwrit.com.au
Fri Sep 9 13:02:49 CEST 2011


On 09/09/2011 03:35 AM, Mohan L wrote:
> Hi All,
>
> I have txt file like :
>
> $ cat data.txt
> US	10
> UK	12
> Ind	4
> Germany	14
> France	8
>
>> rawdata<- read.table(file='data.txt',sep='\t' , header=FALSE)
>
>> rawdata
>         V1 V2
> 1      US 10
> 2      UK 12
> 3     Ind  4
> 4 Germany 14
> 5  France  8
>
> I want to draw pie chart for the above data.
>
> How to  split rawdata into :
> con<- c("US","UK","Ind","Germany","France");
> total<- (10,12,4,14,8)
>
Hi Mohan,
Anything wrong with:

pie(rawdata$V2,labels=rawdata$V1)

Jim



More information about the R-help mailing list