[R] r help for growth rate

Jim Lemon jim at bitwrit.com.au
Mon Feb 28 11:29:58 CET 2011


On 02/28/2011 07:49 PM, Muzna Alvi wrote:
> I'm havinf a problem with a simple file
>
> i have the following data
>
> State  1960  1970  1980  1990
> 1         All India 35988.70 37346.00 39707.30 42321.00
> 2    Andhra Pradesh  3431.03  3163.27  3687.23  3695.63
> 3             Assam  1902.93  2001.60  2278.47  2525.33
> 4             Bihar  5277.07  5133.80  5138.70  4662.57
> 5           Gujarat   538.13   456.10   484.23   590.47
> 6           Haryana   169.33   283.67   489.00   698.67
> 7  Himachal Pradesh    99.38    99.30    97.07    82.50
> 8   Jammu&  Kashmir   226.97   221.83   267.83   275.50
> 9         Karnataka  1084.37  1096.80  1126.43  1319.73
> 10           Kerala   802.97   874.57   795.67   528.97
> 11   Madhya Pradesh  4258.87  4495.97  4857.37  5170.73
> 12      Maharashtra  1352.57  1324.07  1501.77  1555.10
> 13           Orissa  4359.63  4544.33  4136.10  4515.53
> 14           Punjab   262.93   438.47  1255.67  2106.00
> 15        Rajasthan   111.83   129.57   142.80   140.87
> 16       Tamil Nadu  2640.90  2742.60  2195.40  2202.87
> 17    Uttar Pradesh  4358.80  4553.03  5248.03  5419.23
> 18      West Bengal  4549.07  5005.47  5082.57  5763.07
>
>
> i have to find out the percentage in area under rice cultivation from 1960
> and 1990  for all india and for each of the states
> but for some reason when i am using the command
> (1990-1960)/1990*100->  ricefile1$areachange
>
> the areachange column is showing the following (it is showing the area
> change only for all india and replicating itt for all the states as well
>
Hi Muzna,
Try quoting those column names, otherwise the interpreter will think you 
are asking it to do simple arithmetic:

ricefile1$areachange<-
  100*(ricefile1$'1990'-ricefile1$'1960')/ricefile1$'1990'

Jim



More information about the R-help mailing list