o you’ve gone through the Computerworld Beginner’s Guide to R and want to take some next steps in your R journey? In this advanced beginner’s guide, you’ll learn data wrangling, best packages to use for different tasks, how to make maps with R and more.
Table of Contents Create choropleth maps in R
Wrangle data with R n Add a column to an existing data frame
n Step 1: Get election results data
n Syntax 1: By equation
n Step 2: Decide what data to map
n Syntax 2: R’s transform() function
n Step 3: Get your geographic data
n Syntax 3: R’s apply function
n Step 4: Merge spatial and results data
n Syntax 4: mapply()
n Step 5: Create a static map
n Syntax 5: dplyr
n Step 6: Create palette and pop-ups for interactive maps
n Getting summaries by data subgroups
n Step 7: Generate an interactive map
n Bonus special case: Grouping by date range
n Step 8: Add palettes for a multi-layer map
n Sorting your results
n Step 9: Add map layers and controls
n Reshaping: Wide to long
n Step 10: Save your interactive map
n Reshaping: Long to wide
n Create a Leaflet map with markers
n dplyr basics
Extract custom data from the Google Analytics API
Visualizing data with ggplot2 n ggplot2 101
n Step 1: Install packages
n Command cheat sheet
n Step 2: Allow rga to access your Google Analytics account
Great R packages for data import, wrangling and visualization
n Step 3: Extract data n Step 4: Manipulate your data
More R Resources
2
Advanced beginner’s guide to R COMPUTERWORLD.COM
Wrangle data with R I’ve created a sample data set with three years of revenue and profit data from Apple, Google and Microsoft. (The source of the data was the companies themselves; fy means fiscal year. And while the data is a bit old now, the wrangling will be the same regardless of fiscal year.) If you’d like to follow along, you can type (or cut and paste) this into your R terminal window:
Thank you for interesting in our services. We are a non-profit group that run this website to share documents. We need your help to maintenance this website.