November 2017
Beginner to intermediate
204 pages
5h 23m
English
Let's revisit the task of finding the 2011 total, this time using R. The first step is to extract the X2011 values. This has already been done in a previous step, which created the roads.2011 vector.
The next step is to find the sum of all of the values in the roads.2011 vector. One easy way is to use the built in R sum() function with a parameter that skips over NA values. I will show how to use the sum() function in this way this section (feel free to skip ahead if you want the short cut).
First however, I will take a more round about approach to demonstrate the use of indexing. This will involve removing the NA values manually from the roads.2011 vector and then applying the sum() function.
You can create a ...
Read now
Unlock full access