ggplot2 - Disease Maps by using R -
My data set here is attached to .csv file in some body RG to help me create disease maps using GG Plot 2 Could. << >> As long as I generally agree that "there is no free code writing service", this problem is very simple, and it shows how much I have also known intensity of complex visibility in an R in R. It is very difficult to start in R. That's why I have suggested that you use this as a starting point , study code, read the documentation on various functions, and make it automatically Expand. explanation < P> All your data are from the Faisalabad area in Pakistan, as far as I can tell. First we need a map of Pakistan. It is available from many sources, but I like the outstanding website, where you can download Pakistan size e, of course, is in a zip archive, so you have to open the files in a directory ("all your files Along with the directory "as noted in the code). There is a workflow from:
Library (Rg) # readOGR For (...) Library (ArcolterBuver) for # brewer.pal (...) Library (ggplot2) setwd ("& lt; Your file with directory"; pak & lt; - readOGR (dsn = "Map" of map of Pakistan & lt; - pak [pak $ NAME_3 == "Faisalabad",] # Remove Faisalabad area centroids & lt; - data.frame (coordinates (map)) Label (centroids) & lt; -c ("long", "latitude") centroids $ name & lt; - map @ data $ NAME_3 # label (s) pallet #Low-Orange-Red Color Palette GG Plot (Map) + GOM_path (AES (X = Long, Y = LAT, Group = Group)) + GOM_text (Data = Sentiments, AES (X = Long, Y = LET, label = name)) + GOM_point (data = data, AES (x = longitude, y = latitude, size = observation, color = observation)) + scale_color_gradient (low = window) [5], high = palette [9]) + scale_size (guide = "none") + theme_bw () + coord_fixed ()
1. Read the file size: pak & lt; - readOGR (...) 2. Remove the appropriate area: map & lt; - pak [...] Remove the area name and centroid (for the label) 4. Generate color palette: palette and lieutenant; - Brewer Poll (...) 5. Presenting the map, placing points. Edit It has been brought to my attention that GADM has a direct interface in R, which avoids downloading and removing shapes manually . This package is
raster .
# setwd ("Directory with all your files"; ##) pak & lt; - readOGR (dsn = "# map of Pakistan, admin level 3.
Comments
Post a Comment