案例Fin之金融统计编程实现R语言:R code
当前位置:以往案例 > >案例Fin之金融统计编程实现R语言:R code
2019-01-24

Week 2 project: R



Class – for this project, you will have the opportunity to practice many of the R concepts introduced. You will also have the opportunity to learn several new R libraries including Leaflet. Read everything I have written here very carefully.

Instructions:
1) First, review my R code. It is a solution that creates an interactive map that offers expansion and User options.

Here is a link to the map generated by the R code: http://drgates.georgetown.domains/US_county_cancer_poll_map.html

Here is a link to the R code: drgates.georgetown.domains/ANLY500/data/ANLY500_LeafletMapCOPY.R Here is a link to the datasets: http://drgates.georgetown.domains/ANLY500/data/

2) Next, *add on* to my code so that the Map retains all of its current properties AND it also offers two

(2) further User options.

To add User options, you will need to find and clean data that has information about counties. You can add locations of powerplants, you can add further disease data, you can add locations of national parks, etc. etc. It is up to you. You will need to determine how to place the data onto the map – such as with lat and long, FIPS, and/or choropleth. My code has examples and explanations.

Notice that right now, the map is a chorpleth map (color-coded counties) with markers – and with pop- up options that show cancer rates for each state (also color-coded). There is also a clickable option that the User can click that will show (and pop-up information about) Land Use. Notice that the Land Use Sites is a check box that the User can choose or not choose. You can expand or contract this map in real- time. For example, you can look just at the state of CO to see land use there.

Examples:

Here, you can see the map and the Land Use Sites is clicked. You can click on any blue marker or on any colored county and a pop-up will offer further information. All blue markers are for land use in that location. They all have a pop-up option. The User can remove all blue markers by unchecking the Land Use Sites option.



image.png


Next, here I have unclicked (unselected) the Land Use Sites option, and so you can only see the colored counties (choropleth) for cancer rates. If you click any county, a pop-up will appear with rate information.

image.png

Finally, you can pan in and out (expand and contract) the map in real time to view specific states or counties. Here I am looking at CO.



image.png



3) Your goal is to understand all the steps first and review the R code and R methods. Next, you will find data that you can add to this map. You should add on using options – so that the User can check the box or not. For example, if you add National Park Locations, you would have a check box that the User can choose to select. If the User checks the box, markers will appear for all national parks. Each marker should have a pop-up that offers information about that park, etc. Because my markers are blue, it is best to choose a different color.

4) Again, you will add two (2) further User options for the map.

The goal of this project is for you to see R in action, to learn about new libraries, and to learn to find, clean, manipulate, and work with data. It is important to learn to find data, to clean and prepare data, and to link data together for visualization.


Deliverables:


1) Your R code that will include my code and all that you added on to it. Your code MUST run and must produce an interactive map that has three (3) further User options.

** Where ever you add your code – place COMMENTS around your code with your name and what your code does.

2) My code also generates an html file that allows you to place this map online. It is optional to place your map online using the html file. If you do this, please also include the URL to your map. Again, this is optional.

3) Include any and all datasets that you use (after they are clean). Make sure that you include everything necessary for your code to run. Submitted code must run in R Studio, must generate the interactive map, and must have User options as noted above.



4) Place everything for your code into a zip folder and email the zip folder to the TA and cc me. The title of the email must be Week 2 project. Your name MUST be in the email.

Again, the zip folder must contain EVERYTHING necessary to run your code and the map.



在线提交订单