[R] plotting, graph, everything

From: Muzna Alvi <muzna.alvi_at_gmail.com>
Date: Mon, 28 Feb 2011 21:55:00 +0530


I have this assignment to do and after ten hours of constant trying my eyes ache and i give up..

all i'm able to get is this plot

please help me

these are the commands i have used till now

read.table(file.choose(), sep=";", header=T)
read.table(file.choose(), sep=";", header=T)->areas
melt(areas,id=c("Year","State"),m=c("Rice"))-> ricefile
cast(ricefile,State~Year+variable)->ricefile names(ricefile)<- c("State","P1","P2","P3","P4") (ricefile$P4-ricefile$P1)/ricefile$P1-> ricefile$areachange ricefile$areachange*100->ricefile$areachange1 ricefile=ricefile[-1,]
plot(ricefile$areachange1 ~ ricefile$P1, col="red", col.axis=118, col.lab=555, pch=17, xlab="Figure in 1960", ylab="Change over 1960 & 1990") with(ricefile, plot(ricefile$areachange1,ricefile$P1)) with(ricefile, text(ricefile$P1,ricefile$areachange1, ricefile$State), pos=4, xpd=NA)
ggplot(ricefile, aes(x=P1, y=areachange1)) + geom_point() + geom_text(aes(label= State, size=2, vjust=2))

PLEASE HELP!! The question and the data is given below..

[image: Picture of Vikas
Rawal]<http://courseware.macroscan.com/user/view.php?id=2&course=3> another plot

Read the data file /Data/ep602/areas.csv, and make a scatter plot that displays area under rice in 1960s on the x axis, and percentage change in area under rice between 1960 and 1990 on the y axis. Let origin of the plot be at (50 per cent of area of rice in India as a whole,percentage change in area of rice in India as a whole). Then label with name of State three highest/rightmost points and three lowest/leftmost points.

Make a similar graph for wheat.

This is the Data

 Stateno            State Year     Rice    Wheat
1        1          Haryana   60   169.33   693.67
2        1          Haryana   70   283.67  1192.00
3        1          Haryana   80   489.00  1588.00
4        1          Haryana   90   698.67  1920.67
5        2 Himachal Pradesh   60    99.38   302.77
6        2 Himachal Pradesh   70    99.30   316.50
7        2 Himachal Pradesh   80    97.07   356.93
8        2 Himachal Pradesh   90    82.50   372.90
9        3  Jammu & Kashmir   60   226.97   179.37
10       3  Jammu & Kashmir   70   221.83   184.27
11       3  Jammu & Kashmir   80   267.83   203.60
12       3  Jammu & Kashmir   90   275.50   248.27
13       4           Punjab   60   262.93  1535.33
14       4           Punjab   70   438.47  2346.30
15       4           Punjab   80  1255.67  2925.33
16       4           Punjab   90  2106.00  3283.00
17       5    Uttar Pradesh   60  4358.80  3973.80
18       5    Uttar Pradesh   70  4553.03  6029.47
19       5    Uttar Pradesh   80  5248.03  8060.00
20       5    Uttar Pradesh   90  5419.23  8856.40
21       6            Assam   60  1902.93     3.93
22       6            Assam   70  2001.60    57.57
23       6            Assam   80  2278.47   103.27
24       6            Assam   90  2525.33    76.40
25       7            Bihar   60  5277.07   678.07
26       7            Bihar   70  5133.80  1740.70
27       7            Bihar   80  5138.70  1709.43
28       7            Bihar   90  4662.57  2009.57
29       8           Orissa   60  4359.63    12.80
30       8           Orissa   70  4544.33    28.33
31       8           Orissa   80  4136.10    65.57
32       8           Orissa   90  4515.53    13.80
33       9      West Bengal   60  4549.07    48.20
34       9      West Bengal   70  5005.47   383.60
35       9      West Bengal   80  5082.57   254.40
36       9      West Bengal   90  5763.07   275.70
37      10          Gujarat   60   538.13   411.80
38      10          Gujarat   70   456.10   507.67
39      10          Gujarat   80   484.23   668.77
40      10          Gujarat   90   590.47   502.50
41      11   Madhya Pradesh   60  4258.87  3240.23
42      11   Madhya Pradesh   70  4495.97  3448.57
43      11   Madhya Pradesh   80  4857.37  3421.50
44      11   Madhya Pradesh   90  5170.73  3788.97
45      12      Maharashtra   60  1352.57   892.73
46      12      Maharashtra   70  1324.07   860.63
47      12      Maharashtra   80  1501.77  1076.60
48      12      Maharashtra   90  1555.10   686.83
49      13        Rajasthan   60   111.83  1186.50
50      13        Rajasthan   70   129.57  1463.73
51      13        Rajasthan   80   142.80  1824.30
52      13        Rajasthan   90   140.87  2014.33
53      14   Andhra Pradesh   60  3431.03    18.80
54      14   Andhra Pradesh   70  3163.27    19.20
55      14   Andhra Pradesh   80  3687.23    16.97
56      14   Andhra Pradesh   90  3695.63     9.80
57      15        Karnataka   60  1084.37   301.83
58      15        Karnataka   70  1096.80   316.67
59      15        Karnataka   80  1126.43   326.93
60      15        Karnataka   90  1319.73   219.87
61      16           Kerala   60   802.97     0.00
62      16           Kerala   70   874.57     0.00
63      16           Kerala   80   795.67     0.00
64      16           Kerala   90   528.97     0.00
65      17       Tamil Nadu   60  2640.90     1.10
66      17       Tamil Nadu   70  2742.60     1.37
67      17       Tamil Nadu   80  2195.40     0.90
68      17       Tamil Nadu   90  2202.87     0.27
69      99        All India   60 35988.70 13503.70
70      99        All India   70 37346.00 18947.70
71      99        All India   80 39707.30 22663.30
72      99        All India   90 42321.00 24332.70





-- 
--

	[[alternative HTML version deleted]]

______________________________________________
R-help_at_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.
Received on Mon 28 Feb 2011 - 18:26:28 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 Mon 28 Feb 2011 - 21:00:17 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive