ebook img

Data Visualization and Exploration with R A Practical Guide to Using R RStudio and Tidyverse for Data Visualization Exploration and Data Science Applications PDF

238 Pages·2018·20.77 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Data Visualization and Exploration with R A Practical Guide to Using R RStudio and Tidyverse for Data Visualization Exploration and Data Science Applications

Data Visualization and Exploration with R A practical guide to using R, RStudio, and Tidyverse for data visualization, exploration, and data science applications. Eric Pimpler Introduction to Data Visualization and Exploration with R A practical guide to using R, RStudio, and tidyverse for data visualization, exploration, and data science applications. Eric Pimpler Geospatial Training Services 215 W Bandera #114-104 Boerne, TX 78006 PH: 210-260-4992 Email: About the Author Eric Pimpler Eric Pimpler is the founder and owner of Geospatial Training Services (geospatialtraining.com) and have over 25 years of experience implementing and teaching GIS solutions using Esri software. Currently he focuses on data science applications with R along with ArcGIS Pro and Desktop scripting with Python and the development of custom ArcGIS Enterprise (Server) and ArcGIS Online web and mobile applications with JavaScript. Eric is the also the author of several other books including Introduction to Programming ArcGIS Pro with Python (https://www.amazon.com/dp/1979451079/re (https://www.amazon.com/dp/1979451079/re 1&keywords=Programming+ArcGIS+Pro+with +Python), Programming ArcGIS with Python Cookbook (https://www.packtpub.com/ application- development/programmingarcgis-python-cookbook-second-edition), Spatial Analytics with ArcGIS (https://www. packtpub.com/application-development/ spatial-analytics-arcgis), Building Web and Mobile ArcGIS Server Applications with JavaScript (https://www.packtpub.com/ application-development/building- weband-mobile-arcgis-server-applicationsjavascript), and ArcGIS Blueprints (https:// www.packtpub.com/application development/arcgis-blueprints). If you need consulting assistance with your data science or GIS projets please contact Eric at Downloading and Installing Exercise Data for this Book This is intended as a hands-on exercise book and is designed to give you as much handson coding experience with R as possible. Many of the exercises in this book require that you load data from a file-based data source such as a CSV file. These files will need to be installed on your computer before continuing with the exercises in this chapter as well as the rest of the book. Please follow the instructions below to download and install the exercise data 1. In a web browser go to one of the links below to download the exercise data: https://www.dropbox.com/s/5p7j7nl8hgijsnx/IntroR.zip?dl=0. https://s3.amazonaws.com/VirtualGISClassroom/IntroR/IntroR.zip 2. This will download a file called IntroR.zip. 3. The exercise data can be unzipped to any location on your computer. After unzipping the IntroR.zip file you will have a folder structure that includes IntroR as the top-most folder with sub-folders called Data and Solutions. The Data folder contains the data that will be used in the exercises in the book, while the Solutions folder contains solution files for the R script that you will write. RStudio can be used on Windows, Mac, or Linux so rather than specifying a specific folder to place the data I will leave the installation location up to you. Just remember where you unzip the data because you’ll need to reference the location when you set the working directory. 4. For reference purposes I have installed the data to the desktop of my Mac computer under IntroR\Data. You will see this location referenced at various locations throughout the book. However, keep in mind that you can install the data anywhere. Table of Contents CHAPTER 1: Introduction to R and RStudio ....................................................... 9 Introduction to RStudio ...........................................................................................................10 Exercise 1: Creating variables and assigning data .............................................................27 Exercise 2: Using vectors and factors ....................................................................................32 Exercise 3: Using lists .................................................................................................................36 Exercise 4: Using data classes ................................................................................................39 Exercise 5: Looping statements ..............................................................................................46 Exercise 6: Decision support statements – if | else ..............................................................48 Exercise 7: Using functions ......................................................................................................51 Exercise 8: Introduction to tidyverse ......................................................................................53 CHAPTER 2: The Basics of Data Exploration and Visualization with R .......... 57 Exercise 1: Installing and loading tidyverse ..........................................................................58 Exercise 2: Loading and examining a dataset.....................................................................60 Exercise 3: Filtering a dataset .................................................................................................64 Exercise 4: Grouping and summarizing a dataset ...............................................................65 Exercise 5: Plotting a dataset .................................................................................................66 Exercise 6: Graphing burglaries by month and year ...........................................................67 CHAPTER 3: Loading Data into R ...................................................................... 73 Exercise 1: Loading a csv file with read.table() ....................................................................73 Exercise 2: Loading a csv file with read.csv() .......................................................................76 Exercise 3: Loading a tab delimited file with read.table() ..................................................77 Exercise 4: Using readr to load data .....................................................................................77 CHAPTER 4: Transforming Data ........................................................................ 83 Exercise 1: Filtering records to create a subset ....................................................................84 Exercise 2: Narrowing the list of columns with select() ........................................................87 Exercise 3: Arranging Rows .....................................................................................................90 Exercise 4: Adding Rows with mutate() .................................................................................92 Exercise 5: Summarizing and Grouping .................................................................................94 Exercise 6: Piping ......................................................................................................................97 Exercise 7: Challenge ..............................................................................................................99 CHAPTER 5: Creating Tidy Data ..................................................................... 101 Exercise 1: Gathering ............................................................................................................102 Exercise 2: Spreading ............................................................................................................107 Exercise 3: Separating ...........................................................................................................110 Exercise 4: Uniting ..................................................................................................................113 CHAPTER 6: Basic Data Exploration Techniques in R ................................... 115 Exercise 1: Measuring Categorical Variation with a Bar Chart ........................................116 Exercise 2: Measuring Continuous Variation with a Histogram .........................................118 Exercise 3: Measuring Covariation with Box Plots ..............................................................120 Exercise 4: Measuring Covariation with Symbol Size .........................................................122 Exercise 5: 2D bin and hex charts ........................................................................................124 Exercise 6: Generating Summary Statistics .........................................................................126 CHAPTER 7: Basic Data Visualization Techniques ........................................ 129 Step 1: Creating a scatterplot ..............................................................................................130 Step 2: Adding a regression line to the scatterplot ...........................................................133 Step 3: Plotting categories ....................................................................................................136 Step 4: Labeling the graph ...................................................................................................137 Step 5: Legend layouts ..........................................................................................................144 Step 6: Creating a facet .......................................................................................................146 Step 7: Theming......................................................................................................................147 Step 8: Creating bar charts

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.