主要是第二問的解答,用R或者M(jìn)atlab都可。
3. Data Analysis: (40 pts) We want to study the worldwide distribution and temporal
variation of the Gini Index of Diversity. This requires you to do research of your
own on finding map data in R (country names, country outlines etc). Download from
coursework the data in the text file gini.txt into your folder, use the command
gini=read.table("gini.txt",fill=TRUE) to read in the data. Column 3 and 5 represent
dates at which the Gini indices were measured, columns 2 and 4 contain the
indices corresponding to those dates. Column 1 contains the country.
(a) Using the command is.na (and is negation !is.na) take the subset of observations
that have all the information for both dates.
Compare the dates.
Use the subset to visualize the temporal changes of the Gini indices in the
countries where the indices have been measured at two dates. (Hint: You
have to create a non standard plot which shows as much information about the
temporal changes as possible).
(b) Make as good a map of the data as you can.
Hints: Install one of the R packages such as map or maptools. One of the data
sets available with the package will have the outlines for countries with names,
you will need to match most of the names automatically (match function) and
some of the names by hand.
(c) Interpret your output from the two questions above.