Dear R helpers

I have a data which gives Month-wise and Rating-wise Rates. So the input file 
is something like

month           rating           rate
January        AAA             9.04
February      AAA             9.07
..........................................
..........................................
Decemeber     AAA            8.97  
January           BBB           11.15
February         BBB            11.13



January          CCC            17.13
.............................................
............................................
December       CCC           17.56

and so on.

My objective is to calculate Rating-wise mean rate, for which I have used 

rating_mean = tapply(rate, rating, mean) 

and I am getting following output

> tapply(rate, rating, mean)
      AAA           BBB                      CCC 
       9.1104       11.1361637            17.1606779

which is correct when compared with an excel output.

However, I wish to have my output something like a data.frame (so that I should 
be able to save this output as csv file with respective headings and should be 
able to carry out further analysis)

Rating         Mean
AAA            9.1104
BBB           11.1361637
CCC           17.1606779


Please guide as how should I achieve my output like this.
   
Thanking in advance.

Regards

Vincy






        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to