NOTE THAT ((This should be done by R studio !)) Please a. Read the data file the
ID: 3861995 • Letter: N
Question
NOTE THAT
((This should be done by R studio !))
Please
a. Read the data file then do any cleaning and validation.
b. show plots using The ggplot2 package
Year
REX
OilP
Food exports (% of merchandise exports)
Ores and metals exports (% of merchandise exports)
1980
239.5433424
35.52
0.09638294
0.060083757
1981
240.3102173
34
0.094079554
0.024360528
1982
245.3895131
32.38
0.128489839
0.025668368
1983
242.8677506
29.04
..
..
1984
238.0284197
28.2
..
..
1985
221.878717
27.01
0.259787311
0.116943755
1986
169.6457184
13.53
..
..
1987
144.1934823
17.73
..
..
1988
134.5212315
14.24
1.371078529
0.732151804
1989
136.0536024
17.31
1.374888969
0.834330299
1990
125.5311345
22.26
0.713126234
0.491007478
1991
125.8812467
18.62
0.526384845
0.242750346
1992
118.7733668
18.44
1.074388363
0.548851562
1993
122.2521688
16.33
0.982275388
0.429968062
1994
117.8952881
15.53
0.673955645
0.346686956
1995
114.1213899
16.86
0.810242733
0.567217625
1996
116.3114665
20.29
0.632336949
0.304958406
1997
121.4661302
18.86
..
..
1998
127.1948915
12.28
1.114818605
0.507089276
1999
121.9490893
17.44
0.930990348
0.262574488
2000
123.200674
27.6
0.538501429
0.147164016
2001
125.2424379
23.12
0.558465111
0.201693533
2002
121.5455166
24.36
0.628539417
0.223275991
2003
111.1523893
28.1
0.835851768
0.182707717
2004
103.4682918
36.05
0.7405123
0.172800798
2005
100.5070052
50.59
0.620831971
0.137293785
2006
98.93290899
61
0.64203501
0.219532433
2007
95.96813741
69.04
0.838923226
0.283587719
2008
93.62494305
94.1
0.744029125
0.221986187
2009
100.1652448
60.86
1.407633083
0.232499732
2010
100
77.38
1.155876888
0.154654215
2011
96.57013945
107.46
0.898301922
0.122271232
2012
99.61967144
109.45
0.860627792
0.138455596
2013
102.3680362
105.87
0.878931429
0.403127249
2014
105.3894897
96.29
1.006265279
0.769034983
2015
118.5851177
49.49
1.798068624
1.307540253
R ONLY !!
Year
REX
OilP
Food exports (% of merchandise exports)
Ores and metals exports (% of merchandise exports)
1980
239.5433424
35.52
0.09638294
0.060083757
1981
240.3102173
34
0.094079554
0.024360528
1982
245.3895131
32.38
0.128489839
0.025668368
1983
242.8677506
29.04
..
..
1984
238.0284197
28.2
..
..
1985
221.878717
27.01
0.259787311
0.116943755
1986
169.6457184
13.53
..
..
1987
144.1934823
17.73
..
..
1988
134.5212315
14.24
1.371078529
0.732151804
1989
136.0536024
17.31
1.374888969
0.834330299
1990
125.5311345
22.26
0.713126234
0.491007478
1991
125.8812467
18.62
0.526384845
0.242750346
1992
118.7733668
18.44
1.074388363
0.548851562
1993
122.2521688
16.33
0.982275388
0.429968062
1994
117.8952881
15.53
0.673955645
0.346686956
1995
114.1213899
16.86
0.810242733
0.567217625
1996
116.3114665
20.29
0.632336949
0.304958406
1997
121.4661302
18.86
..
..
1998
127.1948915
12.28
1.114818605
0.507089276
1999
121.9490893
17.44
0.930990348
0.262574488
2000
123.200674
27.6
0.538501429
0.147164016
2001
125.2424379
23.12
0.558465111
0.201693533
2002
121.5455166
24.36
0.628539417
0.223275991
2003
111.1523893
28.1
0.835851768
0.182707717
2004
103.4682918
36.05
0.7405123
0.172800798
2005
100.5070052
50.59
0.620831971
0.137293785
2006
98.93290899
61
0.64203501
0.219532433
2007
95.96813741
69.04
0.838923226
0.283587719
2008
93.62494305
94.1
0.744029125
0.221986187
2009
100.1652448
60.86
1.407633083
0.232499732
2010
100
77.38
1.155876888
0.154654215
2011
96.57013945
107.46
0.898301922
0.122271232
2012
99.61967144
109.45
0.860627792
0.138455596
2013
102.3680362
105.87
0.878931429
0.403127249
2014
105.3894897
96.29
1.006265279
0.769034983
2015
118.5851177
49.49
1.798068624
1.307540253
Explanation / Answer
install.packages("ggplot2")
library(ggplot2)
data <- read.table("filepath")
data_clean <- function(data){
data[data==".."] <- 0
data}
allclean = data_clean(data)
print(allclean)
c <- ggplot(allclean, aes(REX, OilP))
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.