Data Manipulation in R

Laurie Stevison & Amanda Clark

Getting Started

If you are using this code with the video, note that some slides have been added post-recording and are not shown. For this video we will be working with the USpop.csv dataset again. Make an R Notebook for this walk through tutorial to save all the code you will be learning. We will cover:

Set up workspace

rm(list=ls())
library(knitr)
library(maps)
library(tidyverse)
## ── Attaching packages ──────────────────────────────────────────────────────── tidyverse 1.3.2 ──
## ✔ ggplot2 3.4.0      ✔ purrr   0.3.5 
## ✔ tibble  3.1.8      ✔ dplyr   1.0.10
## ✔ tidyr   1.2.1      ✔ stringr 1.4.1 
## ✔ readr   2.1.3      ✔ forcats 0.5.2 
## ── Conflicts ─────────────────────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ✖ purrr::map()    masks maps::map()
sessionInfo()
## R version 4.2.1 (2022-06-23)
## Platform: x86_64-apple-darwin17.0 (64-bit)
## Running under: macOS Big Sur 11.7
## 
## Matrix products: default
## LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib
## 
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
##  [1] forcats_0.5.2   stringr_1.4.1   dplyr_1.0.10    purrr_0.3.5     readr_2.1.3    
##  [6] tidyr_1.2.1     tibble_3.1.8    ggplot2_3.4.0   tidyverse_1.3.2 maps_3.4.1     
## [11] knitr_1.40      rmarkdown_2.17 
## 
## loaded via a namespace (and not attached):
##  [1] lubridate_1.9.0     assertthat_0.2.1    digest_0.6.30       utf8_1.2.2         
##  [5] R6_2.5.1            cellranger_1.1.0    backports_1.4.1     reprex_2.0.2       
##  [9] evaluate_0.18       httr_1.4.4          highr_0.9           pillar_1.8.1       
## [13] rlang_1.0.6         googlesheets4_1.0.1 readxl_1.4.1        rstudioapi_0.14    
## [17] jquerylib_0.1.4     googledrive_2.0.0   munsell_0.5.0       broom_1.0.1        
## [21] compiler_4.2.1      modelr_0.1.9        xfun_0.34           pkgconfig_2.0.3    
## [25] htmltools_0.5.3     tidyselect_1.2.0    fansi_1.0.3         crayon_1.5.2       
## [29] tzdb_0.3.0          dbplyr_2.2.1        withr_2.5.0         grid_4.2.1         
## [33] jsonlite_1.8.3      gtable_0.3.1        lifecycle_1.0.3     DBI_1.1.3          
## [37] magrittr_2.0.3      scales_1.2.1        cli_3.4.1           stringi_1.7.8      
## [41] cachem_1.0.6        fs_1.5.2            xml2_1.3.3          bslib_0.4.1        
## [45] ellipsis_0.3.2      generics_0.1.3      vctrs_0.5.0         tools_4.2.1        
## [49] glue_1.6.2          hms_1.1.2           fastmap_1.1.0       yaml_2.3.6         
## [53] timechange_0.1.1    colorspace_2.0-3    gargle_1.2.1        rvest_1.0.3        
## [57] haven_2.5.1         sass_0.4.2
list.files(getwd())
##  [1] "_site.yml"                                   "4.02.Basic_Summary_Statistics_in_R_files"   
##  [3] "4.02.Basic_Summary_Statistics_in_R.html"     "4.02.Basic_Summary_Statistics_in_R.Rmd"     
##  [5] "4.03.Data_Manipulation_in_R.Rmd"             "4.04.Advanced_Statistical_Concepts_in_R.Rmd"
##  [7] "4.05.R_on_CL.Rmd"                            "4.06.Programming_in_R.Rmd"                  
##  [9] "5.03.Advanced_Graphing_in_R.Rmd"             "about.Rmd"                                  
## [11] "Activity1_intro.pdf"                         "activity1.html"                             
## [13] "activity1.Rmd"                               "activity1key.html"                          
## [15] "activity1key.Rmd"                            "activity2.html"                             
## [17] "activity2.Rmd"                               "activity3.html"                             
## [19] "activity3.Rmd"                               "Body_Fat.pdf"                               
## [21] "Congrats.html"                               "Congrats.Rmd"                               
## [23] "data"                                        "docs"                                       
## [25] "images"                                      "index.html"                                 
## [27] "index.Rmd"                                   "LICENSE"                                    
## [29] "module1.html"                                "module1.Rmd"                                
## [31] "module2.html"                                "module2.Rmd"                                
## [33] "module3.html"                                "module3.Rmd"                                
## [35] "module4.html"                                "module4.Rmd"                                
## [37] "module5.html"                                "module5.Rmd"                                
## [39] "module6.html"                                "module6.Rmd"                                
## [41] "module7.html"                                "module7.Rmd"                                
## [43] "modules"                                     "R_Mini_Course.Rproj"                        
## [45] "raw_data"                                    "README.md"                                  
## [47] "README.Rmd"                                  "site_libs"

Read in dataset

You will need to add path information to the raw_data directory once you have uncompressed the data tarball. As we did in the last video, read the USpop.csv file into an object called “data”:

#data=read.csv(file="USPop.csv")
#View(data)

You may also read in the previously made object into “data”:

data <- readRDS(file = "data/USPop.rds")
head(data)
##   Year Population
## 1 1790    3929214
## 2 1800    5308483
## 3 1810    7239881
## 4 1820    9638453
## 5 1830   12866020
## 6 1840   17069453

Click the data object in the environment tab in RStudio. Notice we have two columns of data, year and population size.

Add a new column

An easy new column to add is a midpoint between two existing columns. In this way, we can add five to every item in the vector data$Year to create a new vector data$midpoint:

data$midpoint=data$Year+5
#View(data)

Click the data object in the environment tab in RStudio again. Notice there is now a third column labeled midpoint.

The “tidy” way

Occasionally, you may see alternative methods of performing some task in R using tools from the meta package tidyverse. We will introduce some basic utility from this meta package throughout the modules. Let’s add the new column using the dplyr and magrittr packages from tidyverse

tidydata <- data %>% mutate(midpoint = Year+5)

%>% from the magrittr package is a pipe! This means it is used to pass information from the left of the symbol to functions on the right.

Here we are passing the contents of data to the dplyr function mutate() creating a new column named “midpoint.” Midpoint contains the value in Year plus 5.

Initialize a vector

Another way to add to a dataset is to initialize a vector outside of a data frame.

growth=vector(mode="numeric",length=length(data$Year))

In setting up this vector, we have made it the same length as our existing vector data$Year. We also set it up to be numeric indicating we want R to treat it as numbers.

We will store population growth in this vector, and will thus need to compare the population size in year i to year i-1. What concepts have you learned in this course that will make this easy?

Fill vector via a for-loop

Similar to how we’ve done this in shell, we set a loop variable i and set the loop to start at 2 and stop at the length of data$Year. Because growth compares intervals of time, we will have a vector that is one less than the current vector length. However, R doesn’t like this, so we will set the first value as missing data.

growth[1]=NA
for (i in 2:length(data$Year)) {
    growth[i]=data$Population[i]-data$Population[i-1]+1
}

Examine the formula in the loop. Why do we add 1 to the growth for each iteration?

Another way to add columns

data=cbind(data,growth)

Here, we’ve reset the object data as a combination of the existing object and our new vector.

The “tidy” way

We combine data and growth using dplyr:

tidydata <- bind_cols(tidydata, as_tibble(growth)) %>% 
  rename(growth = value)

Here, we are using bind_cols to combining “tidydata” & “growth”. Notice that we coerced “growth” into a tibble (a tidy data frame) to match the structure of “tidydata”. We wanted the column to be called “growth”, so we renamed it with rename!

dplyr (a grammar of data manipulation) was developed with the end user in mind. The package contains a few clear, explanatory verbs that perform common data manipulations. Here are a few other manipulations and functions you should be aware about:

Getting subsets of a dataset with filter

# only rows where population size is greater than or equal to the mean
tidydata_pop_filter <- tidydata %>% filter(Population >= mean(Population))

Use the help pane to search for slice_max() or in the console type ?slice_max. Try to craft and execute a command using this function to 50% of the rows with the highest growth values. Guidance: slice_max(growth, prop = .5)

Getting specific columns or variables with select

# isolate the growth and filtered population columns
tidydata_pop_select <- tidydata_pop_filter %>% select(Population, growth)

Getting the mean population size and growth with summarise & across

# summarizing across variables
tidydata_pop_means <- tidydata_pop_select %>% summarise(across(everything(),mean))

Final words on dplyr

tidyverse was created by Hadley Wickham (Statistician and Chief Scientists at RStudio) and associates. It is meant to make the coding syntax and structure more intuitive and understandable. dplyr is one of many other packages within the tidyverse, but they all share the same underlying design and data structures (i.e., they work well together). Interested in learning more? Check out tidyverse. Check out the book R for Data Science. Check out the dplyr cheatsheet.

Visual inspection of new vector

Now, back to the data set. As we did before, let’s explore this new data visually

hist(growth)

Does this data follow a normal distribution?

Log transformation

Transformation is a nice way of converting your data into a normal distribution, an underlying assumption of many statistical tests. Below, we impose a log transformation.

data$log=log(data$growth)
hist(data$log)

How does this distribution compare to the last one?

Now, let’s look at growth over time:

#plot from last video
plot(data[,1], data[,2],pch=11, col="#66CDAA",cex=0.8)

#plot of growth (without transformation)
plot(data$Year,data$growth)

#plot of log growth
plot(data$Year,data$log)

Does the transformation change much for the plot?

Test for a statistical correlation

Let’s see how our transformation impacts a test for a statistical correlation.

cor.test(data$Year,data$growth,method="spearman")
## 
##  Spearman's rank correlation rho
## 
## data:  data$Year and data$growth
## S = 76, p-value = 3.799e-06
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##       rho 
## 0.9570864
cor.test(data$Year,data$log,method="spearman")
## 
##  Spearman's rank correlation rho
## 
## data:  data$Year and data$log
## S = 76, p-value = 3.799e-06
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##       rho 
## 0.9570864

Why are these values the same?

Quake Dataset

Next, let’s examine another R built-in dataset, quakes

Quakes
lat long depth mag stations
-20.42 181.62 562 4.8 41
-20.62 181.03 650 4.2 15
-26.00 184.10 42 5.4 43
-17.97 181.66 626 4.1 19
-20.42 181.96 649 4.0 11
-19.68 184.31 195 4.0 12
-11.70 166.10 82 4.8 43
-28.11 181.93 194 4.4 15
-28.74 181.74 211 4.7 35
-17.47 179.59 622 4.3 19
-21.44 180.69 583 4.4 13
-12.26 167.00 249 4.6 16
-18.54 182.11 554 4.4 19
-21.00 181.66 600 4.4 10
-20.70 169.92 139 6.1 94
-15.94 184.95 306 4.3 11
-13.64 165.96 50 6.0 83
-17.83 181.50 590 4.5 21
-23.50 179.78 570 4.4 13
-22.63 180.31 598 4.4 18
-20.84 181.16 576 4.5 17
-10.98 166.32 211 4.2 12
-23.30 180.16 512 4.4 18
-30.20 182.00 125 4.7 22
-19.66 180.28 431 5.4 57
-17.94 181.49 537 4.0 15
-14.72 167.51 155 4.6 18
-16.46 180.79 498 5.2 79
-20.97 181.47 582 4.5 25
-19.84 182.37 328 4.4 17
-22.58 179.24 553 4.6 21
-16.32 166.74 50 4.7 30
-15.55 185.05 292 4.8 42
-23.55 180.80 349 4.0 10
-16.30 186.00 48 4.5 10
-25.82 179.33 600 4.3 13
-18.73 169.23 206 4.5 17
-17.64 181.28 574 4.6 17
-17.66 181.40 585 4.1 17
-18.82 169.33 230 4.4 11
-37.37 176.78 263 4.7 34
-15.31 186.10 96 4.6 32
-24.97 179.82 511 4.4 23
-15.49 186.04 94 4.3 26
-19.23 169.41 246 4.6 27
-30.10 182.30 56 4.9 34
-26.40 181.70 329 4.5 24
-11.77 166.32 70 4.4 18
-24.12 180.08 493 4.3 21
-18.97 185.25 129 5.1 73
-18.75 182.35 554 4.2 13
-19.26 184.42 223 4.0 15
-22.75 173.20 46 4.6 26
-21.37 180.67 593 4.3 13
-20.10 182.16 489 4.2 16
-19.85 182.13 562 4.4 31
-22.70 181.00 445 4.5 17
-22.06 180.60 584 4.0 11
-17.80 181.35 535 4.4 23
-24.20 179.20 530 4.3 12
-20.69 181.55 582 4.7 35
-21.16 182.40 260 4.1 12
-13.82 172.38 613 5.0 61
-11.49 166.22 84 4.6 32
-20.68 181.41 593 4.9 40
-17.10 184.93 286 4.7 25
-20.14 181.60 587 4.1 13
-21.96 179.62 627 5.0 45
-20.42 181.86 530 4.5 27
-15.46 187.81 40 5.5 91
-15.31 185.80 152 4.0 11
-19.86 184.35 201 4.5 30
-11.55 166.20 96 4.3 14
-23.74 179.99 506 5.2 75
-17.70 181.23 546 4.4 35
-23.54 180.04 564 4.3 15
-19.21 184.70 197 4.1 11
-12.11 167.06 265 4.5 23
-21.81 181.71 323 4.2 15
-28.98 181.11 304 5.3 60
-34.02 180.21 75 5.2 65
-23.84 180.99 367 4.5 27
-19.57 182.38 579 4.6 38
-20.12 183.40 284 4.3 15
-17.70 181.70 450 4.0 11
-19.66 184.31 170 4.3 15
-21.50 170.50 117 4.7 32
-23.64 179.96 538 4.5 26
-15.43 186.30 123 4.2 16
-15.41 186.44 69 4.3 42
-15.48 167.53 128 5.1 61
-13.36 167.06 236 4.7 22
-20.64 182.02 497 5.2 64
-19.72 169.71 271 4.2 14
-15.44 185.26 224 4.2 21
-19.73 182.40 375 4.0 18
-27.24 181.11 365 4.5 21
-18.16 183.41 306 5.2 54
-13.66 166.54 50 5.1 45
-24.57 179.92 484 4.7 33
-16.98 185.61 108 4.1 12
-26.20 178.41 583 4.6 25
-21.88 180.39 608 4.7 30
-33.00 181.60 72 4.7 22
-21.33 180.69 636 4.6 29
-19.44 183.50 293 4.2 15
-34.89 180.60 42 4.4 25
-20.24 169.49 100 4.6 22
-22.55 185.90 42 5.7 76
-36.95 177.81 146 5.0 35
-15.75 185.23 280 4.5 28
-16.85 182.31 388 4.2 14
-19.06 182.45 477 4.0 16
-26.11 178.30 617 4.8 39
-26.20 178.35 606 4.4 21
-26.13 178.31 609 4.2 25
-13.66 172.23 46 5.3 67
-13.47 172.29 64 4.7 14
-14.60 167.40 178 4.8 52
-18.96 169.48 248 4.2 13
-14.65 166.97 82 4.8 28
-19.90 178.90 81 4.3 11
-22.05 180.40 606 4.7 27
-19.22 182.43 571 4.5 23
-31.24 180.60 328 4.4 18
-17.93 167.89 49 5.1 43
-19.30 183.84 517 4.2 21
-26.53 178.57 600 5.0 69
-27.72 181.70 94 4.8 59
-19.19 183.51 307 4.3 19
-17.43 185.43 189 4.5 22
-17.05 181.22 527 4.2 24
-19.52 168.98 63 4.5 21
-23.71 180.30 510 4.6 30
-21.30 180.82 624 4.3 14
-16.24 168.02 53 4.7 12
-16.14 187.32 42 5.1 68
-23.95 182.80 199 4.6 14
-25.20 182.60 149 4.9 31
-18.84 184.16 210 4.2 17
-12.66 169.46 658 4.6 43
-20.65 181.40 582 4.0 14
-13.23 167.10 220 5.0 46
-29.91 181.43 205 4.4 34
-14.31 173.50 614 4.2 23
-20.10 184.40 186 4.2 10
-17.80 185.17 97 4.4 22
-21.27 173.49 48 4.9 42
-23.58 180.17 462 5.3 63
-17.90 181.50 573 4.0 19
-23.34 184.50 56 5.7 106
-15.56 167.62 127 6.4 122
-23.83 182.56 229 4.3 24
-11.80 165.80 112 4.2 20
-15.54 167.68 140 4.7 16
-20.65 181.32 597 4.7 39
-11.75 166.07 69 4.2 14
-24.81 180.00 452 4.3 19
-20.90 169.84 93 4.9 31
-11.34 166.24 103 4.6 30
-17.98 180.50 626 4.1 19
-24.34 179.52 504 4.8 34
-13.86 167.16 202 4.6 30
-35.56 180.20 42 4.6 32
-35.48 179.90 59 4.8 35
-34.20 179.43 40 5.0 37
-26.00 182.12 205 5.6 98
-19.89 183.84 244 5.3 73
-23.43 180.00 553 4.7 41
-18.89 169.42 239 4.5 27
-17.82 181.83 640 4.3 24
-25.68 180.34 434 4.6 41
-20.20 180.90 627 4.1 11
-15.20 184.68 99 4.1 14
-15.03 182.29 399 4.1 10
-32.22 180.20 216 5.7 90
-22.64 180.64 544 5.0 50
-17.42 185.16 206 4.5 22
-17.84 181.48 542 4.1 20
-15.02 184.24 339 4.6 27
-18.04 181.75 640 4.5 47
-24.60 183.50 67 4.3 25
-19.88 184.30 161 4.4 17
-20.30 183.00 375 4.2 15
-20.45 181.85 534 4.1 14
-17.67 187.09 45 4.9 62
-22.30 181.90 309 4.3 11
-19.85 181.85 576 4.9 54
-24.27 179.88 523 4.6 24
-15.85 185.13 290 4.6 29
-20.02 184.09 234 5.3 71
-18.56 169.31 223 4.7 35
-17.87 182.00 569 4.6 12
-24.08 179.50 605 4.1 21
-32.20 179.61 422 4.6 41
-20.36 181.19 637 4.2 23
-23.85 182.53 204 4.6 27
-24.00 182.75 175 4.5 14
-20.41 181.74 538 4.3 31
-17.72 180.30 595 5.2 74
-19.67 182.18 360 4.3 23
-17.70 182.20 445 4.0 12
-16.23 183.59 367 4.7 35
-26.72 183.35 190 4.5 36
-12.95 169.09 629 4.5 19
-21.97 182.32 261 4.3 13
-21.96 180.54 603 5.2 66
-20.32 181.69 508 4.5 14
-30.28 180.62 350 4.7 32
-20.20 182.30 533 4.2 11
-30.66 180.13 411 4.7 42
-16.17 184.10 338 4.3 13
-28.25 181.71 226 4.1 19
-20.47 185.68 93 5.4 85
-23.55 180.27 535 4.3 22
-20.94 181.58 573 4.3 21
-26.67 182.40 186 4.2 17
-18.13 181.52 618 4.6 41
-20.21 183.83 242 4.4 29
-18.31 182.39 342 4.2 14
-16.52 185.70 90 4.7 30
-22.36 171.65 130 4.6 39
-22.43 184.48 65 4.9 48
-20.37 182.10 397 4.2 22
-23.77 180.16 505 4.5 26
-13.65 166.66 71 4.9 52
-21.55 182.90 207 4.2 18
-16.24 185.75 154 4.5 22
-23.73 182.53 232 5.0 55
-22.34 171.52 106 5.0 43
-19.40 180.94 664 4.7 34
-24.64 180.81 397 4.3 24
-16.00 182.82 431 4.4 16
-19.62 185.35 57 4.9 31
-23.84 180.13 525 4.5 15
-23.54 179.93 574 4.0 12
-28.23 182.68 74 4.4 20
-21.68 180.63 617 5.0 63
-13.44 166.53 44 4.7 27
-24.96 180.22 470 4.8 41
-20.08 182.74 298 4.5 33
-24.36 182.84 148 4.1 16
-14.70 166.00 48 5.3 16
-18.20 183.68 107 4.8 52
-16.65 185.51 218 5.0 52
-18.11 181.67 597 4.6 28
-17.95 181.65 619 4.3 26
-15.50 186.90 46 4.7 18
-23.36 180.01 553 5.3 61
-19.15 169.50 150 4.2 12
-10.97 166.26 180 4.7 26
-14.85 167.24 97 4.5 26
-17.80 181.38 587 5.1 47
-22.50 170.40 106 4.9 38
-29.10 182.10 179 4.4 19
-20.32 180.88 680 4.2 22
-16.09 184.89 304 4.6 34
-19.18 169.33 254 4.7 35
-23.81 179.36 521 4.2 23
-23.79 179.89 526 4.9 43
-19.02 184.23 270 5.1 72
-20.90 181.51 548 4.7 32
-19.06 169.01 158 4.4 10
-17.88 181.47 562 4.4 27
-19.41 183.05 300 4.2 16
-26.17 184.20 65 4.9 37
-14.95 167.24 130 4.6 16
-18.73 168.80 82 4.4 14
-20.21 182.37 482 4.6 37
-21.29 180.85 607 4.5 23
-19.76 181.41 105 4.4 15
-22.09 180.38 590 4.9 35
-23.80 179.90 498 4.1 12
-20.16 181.99 504 4.2 11
-22.13 180.38 577 5.7 104
-17.44 181.40 529 4.6 25
-23.33 180.18 528 5.0 59
-24.78 179.22 492 4.3 16
-22.00 180.52 561 4.5 19
-19.13 182.51 579 5.2 56
-30.72 180.10 413 4.4 22
-22.32 180.54 565 4.2 12
-16.45 177.77 138 4.6 17
-17.70 185.00 383 4.0 10
-17.95 184.68 260 4.4 21
-24.40 179.85 522 4.7 29
-19.30 180.60 671 4.2 16
-21.13 185.32 123 4.7 36
-18.07 181.57 572 4.5 26
-20.60 182.28 529 5.0 50
-18.48 181.49 641 5.0 49
-13.34 166.20 67 4.8 18
-20.92 181.50 546 4.6 31
-25.31 179.69 507 4.6 35
-15.24 186.21 158 5.0 57
-16.40 185.86 148 5.0 47
-24.57 178.40 562 5.6 80
-17.94 181.51 601 4.0 16
-30.64 181.20 175 4.0 16
-18.64 169.32 260 4.6 23
-13.09 169.28 654 4.4 22
-19.68 184.14 242 4.8 40
-16.44 185.74 126 4.7 30
-21.09 181.38 555 4.6 15
-14.99 171.39 637 4.3 21
-23.30 179.70 500 4.7 29
-17.68 181.36 515 4.1 19
-22.00 180.53 583 4.9 20
-21.38 181.39 501 4.6 36
-32.62 181.50 55 4.8 26
-13.05 169.58 644 4.9 68
-12.93 169.63 641 5.1 57
-18.60 181.91 442 5.4 82
-21.34 181.41 464 4.5 21
-21.48 183.78 200 4.9 54
-17.40 181.02 479 4.4 14
-17.32 181.03 497 4.1 13
-18.77 169.24 218 5.3 53
-26.16 179.50 492 4.5 25
-12.59 167.10 325 4.9 26
-14.82 167.32 123 4.8 28
-21.79 183.48 210 5.2 69
-19.83 182.04 575 4.4 23
-29.50 182.31 129 4.4 14
-12.49 166.36 74 4.9 55
-26.10 182.30 49 4.4 11
-21.04 181.20 483 4.2 10
-10.78 165.77 93 4.6 20
-20.76 185.77 118 4.6 15
-11.41 166.24 83 5.3 55
-19.10 183.87 61 5.3 42
-23.91 180.00 534 4.5 11
-27.33 182.60 42 4.4 11
-12.25 166.60 219 5.0 28
-23.49 179.07 544 5.1 58
-27.18 182.18 56 4.5 14
-25.80 182.10 68 4.5 26
-27.19 182.18 69 5.4 68
-27.27 182.38 45 4.5 16
-27.10 182.18 43 4.7 17
-27.22 182.28 65 4.2 14
-27.38 181.70 80 4.8 13
-27.27 182.50 51 4.5 13
-27.54 182.50 68 4.3 12
-27.20 182.39 69 4.3 14
-27.71 182.47 103 4.3 11
-27.60 182.40 61 4.6 11
-27.38 182.39 69 4.5 12
-21.54 185.48 51 5.0 29
-27.21 182.43 55 4.6 10
-28.96 182.61 54 4.6 15
-12.01 166.29 59 4.9 27
-17.46 181.32 573 4.1 17
-30.17 182.02 56 5.5 68
-27.27 182.36 65 4.7 21
-17.79 181.32 587 5.0 49
-22.19 171.40 150 5.1 49
-17.10 182.68 403 5.5 82
-27.18 182.53 60 4.6 21
-11.64 166.47 130 4.7 19
-17.98 181.58 590 4.2 14
-16.90 185.72 135 4.0 22
-21.98 179.60 583 5.4 67
-32.14 179.90 406 4.3 19
-18.80 169.21 221 4.4 16
-26.78 183.61 40 4.6 22
-20.43 182.37 502 5.1 48
-18.30 183.20 103 4.5 14
-15.83 182.51 423 4.2 21
-23.44 182.93 158 4.1 20
-23.73 179.99 527 5.1 49
-19.89 184.08 219 5.4 105
-17.59 181.09 536 5.1 61
-19.77 181.40 630 5.1 54
-20.31 184.06 249 4.4 21
-15.33 186.75 48 5.7 123
-18.20 181.60 553 4.4 14
-15.36 186.66 112 5.1 57
-15.29 186.42 153 4.6 31
-15.36 186.71 130 5.5 95
-16.24 167.95 188 5.1 68
-13.47 167.14 226 4.4 26
-25.50 182.82 124 5.0 25
-14.32 167.33 204 5.0 49
-20.04 182.01 605 5.1 49
-28.83 181.66 221 5.1 63
-17.82 181.49 573 4.2 14
-27.23 180.98 401 4.5 39
-10.72 165.99 195 4.0 14
-27.00 183.88 56 4.9 36
-20.36 186.16 102 4.3 21
-27.17 183.68 44 4.8 27
-20.94 181.26 556 4.4 21
-17.46 181.90 417 4.2 14
-21.04 181.20 591 4.9 45
-23.70 179.60 646 4.2 21
-17.72 181.42 565 5.3 89
-15.87 188.13 52 5.0 30
-17.84 181.30 535 5.7 112
-13.45 170.30 641 5.3 93
-30.80 182.16 41 4.7 24
-11.63 166.14 109 4.6 36
-30.40 181.40 40 4.3 17
-26.18 178.59 548 5.4 65
-15.70 184.50 118 4.4 30
-17.95 181.50 593 4.3 16
-20.51 182.30 492 4.3 23
-15.36 167.51 123 4.7 28
-23.61 180.23 475 4.4 26
-33.20 181.60 153 4.2 21
-17.68 186.80 112 4.5 35
-22.24 184.56 99 4.8 57
-20.07 169.14 66 4.8 37
-25.04 180.10 481 4.3 15
-21.50 185.20 139 4.4 15
-14.28 167.26 211 5.1 51
-14.43 167.26 151 4.4 17
-32.70 181.70 211 4.4 40
-34.10 181.80 246 4.3 23
-19.70 186.20 47 4.8 19
-24.19 180.38 484 4.3 27
-26.60 182.77 119 4.5 29
-17.04 186.80 70 4.1 22
-22.10 179.71 579 5.1 58
-32.60 180.90 57 4.7 44
-33.00 182.40 176 4.6 28
-20.58 181.24 602 4.7 44
-20.61 182.60 488 4.6 12
-19.47 169.15 149 4.4 15
-17.47 180.96 546 4.2 23
-18.40 183.40 343 4.1 10
-23.33 180.26 530 4.7 22
-18.55 182.23 563 4.0 17
-26.16 178.47 537 4.8 33
-21.80 183.20 325 4.4 19
-27.63 182.93 80 4.3 14
-18.89 169.48 259 4.4 21
-20.30 182.30 476 4.5 10
-20.56 182.04 499 4.5 29
-16.10 185.32 257 4.7 30
-12.66 166.37 165 4.3 18
-21.05 184.68 136 4.7 29
-17.97 168.52 146 4.8 33
-19.83 182.54 524 4.6 14
-22.55 183.81 82 5.1 68
-22.28 183.52 90 4.7 19
-15.72 185.64 138 4.3 21
-20.85 181.59 499 5.1 91
-21.11 181.50 538 5.5 104
-25.31 180.15 467 4.5 25
-26.46 182.50 184 4.3 11
-24.09 179.68 538 4.3 21
-16.96 167.70 45 4.7 23
-23.19 182.80 237 4.3 18
-20.81 184.70 162 4.3 20
-15.03 167.32 136 4.6 20
-18.06 181.59 604 4.5 23
-19.00 185.60 107 4.5 15
-23.53 179.99 538 5.4 87
-18.18 180.63 639 4.6 39
-15.66 186.80 45 4.4 11
-18.00 180.62 636 5.0 100
-18.08 180.70 628 5.2 72
-18.05 180.86 632 4.4 15
-29.90 181.16 215 5.1 51
-20.90 181.90 556 4.4 17
-15.61 167.50 135 4.4 21
-16.03 185.43 297 4.8 25
-17.68 181.11 568 4.4 22
-31.94 180.57 168 4.7 39
-19.14 184.36 269 4.7 31
-18.00 185.48 143 4.4 29
-16.95 185.94 95 4.3 12
-10.79 166.06 142 5.0 40
-20.83 185.90 104 4.5 19
-32.90 181.60 169 4.6 27
-37.93 177.47 65 5.4 65
-29.09 183.20 54 4.6 23
-23.56 180.23 474 4.5 13
-19.60 185.20 125 4.4 13
-21.39 180.68 617 4.5 18
-14.85 184.87 294 4.1 10
-22.70 183.30 180 4.0 13
-32.42 181.21 47 4.9 39
-17.90 181.30 593 4.1 13
-23.58 183.40 94 5.2 79
-34.40 180.50 201 4.4 41
-17.61 181.20 537 4.1 11
-21.07 181.13 594 4.9 43
-13.84 170.62 638 4.6 20
-30.24 181.63 80 4.5 17
-18.49 169.04 211 4.8 30
-23.45 180.23 520 4.2 19
-16.04 183.54 384 4.2 23
-17.14 185.31 223 4.1 15
-22.54 172.91 54 5.5 71
-15.90 185.30 57 4.4 19
-30.04 181.20 49 4.8 20
-24.03 180.22 508 4.2 23
-18.89 184.46 242 4.8 36
-16.51 187.10 62 4.9 46
-20.10 186.30 63 4.6 19
-21.06 183.81 203 4.5 34
-13.07 166.87 132 4.4 24
-23.46 180.09 543 4.6 28
-19.41 182.30 589 4.2 19
-11.81 165.98 51 4.7 28
-11.76 165.96 45 4.4 51
-12.08 165.76 63 4.5 51
-25.59 180.02 485 4.9 48
-26.54 183.63 66 4.7 34
-20.90 184.28 58 5.5 92
-16.99 187.00 70 4.7 30
-23.46 180.17 541 4.6 32
-17.81 181.82 598 4.1 14
-15.17 187.20 50 4.7 28
-11.67 166.02 102 4.6 21
-20.75 184.52 144 4.3 25
-19.50 186.90 58 4.4 20
-26.18 179.79 460 4.7 44
-20.66 185.77 69 4.3 25
-19.22 182.54 570 4.1 22
-24.68 183.33 70 4.7 30
-15.43 167.38 137 4.5 16
-32.45 181.15 41 5.5 81
-21.31 180.84 586 4.5 17
-15.44 167.18 140 4.6 44
-13.26 167.01 213 5.1 70
-15.26 183.13 393 4.4 28
-33.57 180.80 51 4.7 35
-15.77 167.01 64 5.5 73
-15.79 166.83 45 4.6 39
-21.00 183.20 296 4.0 16
-16.28 166.94 50 4.6 24
-23.28 184.60 44 4.8 34
-16.10 167.25 68 4.7 36
-17.70 181.31 549 4.7 33
-15.96 166.69 150 4.2 20
-15.95 167.34 47 5.4 87
-17.56 181.59 543 4.6 34
-15.90 167.42 40 5.5 86
-15.29 166.90 100 4.2 15
-15.86 166.85 85 4.5 22
-16.20 166.80 98 4.5 21
-15.71 166.91 58 4.8 20
-16.45 167.54 125 4.6 18
-11.54 166.18 89 5.4 80
-19.61 181.91 590 4.6 34
-15.61 187.15 49 5.0 30
-21.16 181.41 543 4.3 17
-20.65 182.22 506 4.3 24
-20.33 168.71 40 4.8 38
-15.08 166.62 42 4.7 23
-23.28 184.61 76 4.7 36
-23.44 184.60 63 4.8 27
-23.12 184.42 104 4.2 17
-23.65 184.46 93 4.2 16
-22.91 183.95 64 5.9 118
-22.06 180.47 587 4.6 28
-13.56 166.49 83 4.5 25
-17.99 181.57 579 4.9 49
-23.92 184.47 40 4.7 17
-30.69 182.10 62 4.9 25
-21.92 182.80 273 5.3 78
-25.04 180.97 393 4.2 21
-19.92 183.91 264 4.2 23
-27.75 182.26 174 4.5 18
-17.71 181.18 574 5.2 67
-19.60 183.84 309 4.5 23
-34.68 179.82 75 5.6 79
-14.46 167.26 195 5.2 87
-18.85 187.55 44 4.8 35
-17.02 182.41 420 4.5 29
-20.41 186.51 63 5.0 28
-18.18 182.04 609 4.4 26
-16.49 187.80 40 4.5 18
-17.74 181.31 575 4.6 42
-20.49 181.69 559 4.5 24
-18.51 182.64 405 5.2 74
-27.28 183.40 70 5.1 54
-15.90 167.16 41 4.8 42
-20.57 181.33 605 4.3 18
-11.25 166.36 130 5.1 55
-20.04 181.87 577 4.7 19
-20.89 181.25 599 4.6 20
-16.62 186.74 82 4.8 51
-20.09 168.75 50 4.6 23
-24.96 179.87 480 4.4 25
-20.95 181.42 559 4.6 27
-23.31 179.27 566 5.1 49
-20.95 181.06 611 4.3 20
-21.58 181.90 409 4.4 19
-13.62 167.15 209 4.7 30
-12.72 166.28 70 4.8 47
-21.79 185.00 74 4.1 15
-20.48 169.76 134 4.6 33
-12.84 166.78 150 4.9 35
-17.02 182.93 406 4.0 17
-23.89 182.39 243 4.7 32
-23.07 184.03 89 4.7 32
-27.98 181.96 53 5.2 89
-28.10 182.25 68 4.6 18
-21.24 180.81 605 4.6 34
-21.24 180.86 615 4.9 23
-19.89 174.46 546 5.7 99
-32.82 179.80 176 4.7 26
-22.00 185.50 52 4.4 18
-21.57 185.62 66 4.9 38
-24.50 180.92 377 4.8 43
-33.03 180.20 186 4.6 27
-30.09 182.40 51 4.4 18
-22.75 170.99 67 4.8 35
-17.99 168.98 234 4.7 28
-19.60 181.87 597 4.2 18
-15.65 186.26 64 5.1 54
-17.78 181.53 511 4.8 56
-22.04 184.91 47 4.9 47
-20.06 168.69 49 5.1 49
-18.07 181.54 546 4.3 28
-12.85 165.67 75 4.4 30
-33.29 181.30 60 4.7 33
-34.63 179.10 278 4.7 24
-24.18 179.02 550 5.3 86
-23.78 180.31 518 5.1 71
-22.37 171.50 116 4.9 38
-23.97 179.91 518 4.5 23
-34.12 181.75 75 4.7 41
-25.25 179.86 491 4.2 23
-22.87 172.65 56 5.1 50
-18.48 182.37 376 4.8 57
-21.46 181.02 584 4.2 18
-28.56 183.47 48 4.8 56
-28.56 183.59 53 4.4 20
-21.30 180.92 617 4.5 26
-20.08 183.22 294 4.3 18
-18.82 182.21 417 5.6 129
-19.51 183.97 280 4.0 16
-12.05 167.39 332 5.0 36
-17.40 186.54 85 4.2 28
-23.93 180.18 525 4.6 31
-21.23 181.09 613 4.6 18
-16.23 167.91 182 4.5 28
-28.15 183.40 57 5.0 32
-20.81 185.01 79 4.7 42
-20.72 181.41 595 4.6 36
-23.29 184.00 164 4.8 50
-38.46 176.03 148 4.6 44
-15.48 186.73 82 4.4 17
-37.03 177.52 153 5.6 87
-20.48 181.38 556 4.2 13
-18.12 181.88 649 5.4 88
-18.17 181.98 651 4.8 43
-11.40 166.07 93 5.6 94
-23.10 180.12 533 4.4 27
-14.28 170.34 642 4.7 29
-22.87 171.72 47 4.6 27
-17.59 180.98 548 5.1 79
-27.60 182.10 154 4.6 22
-17.94 180.60 627 4.5 29
-17.88 180.58 622 4.2 23
-30.01 180.80 286 4.8 43
-19.19 182.30 390 4.9 48
-18.14 180.87 624 5.5 105
-23.46 180.11 539 5.0 41
-18.44 181.04 624 4.2 21
-18.21 180.87 631 5.2 69
-18.26 180.98 631 4.8 36
-15.85 184.83 299 4.4 30
-23.82 180.09 498 4.8 40
-18.60 184.28 255 4.4 31
-17.80 181.32 539 4.1 12
-10.78 166.10 195 4.9 45
-18.12 181.71 594 4.6 24
-19.34 182.62 573 4.5 32
-15.34 167.10 128 5.3 18
-24.97 182.85 137 4.8 40
-15.97 186.08 143 4.6 41
-23.47 180.24 511 4.8 37
-23.11 179.15 564 4.7 17
-20.54 181.66 559 4.9 50
-18.92 169.37 248 5.3 60
-20.16 184.27 210 4.4 27
-25.48 180.94 390 4.6 33
-18.19 181.74 616 4.3 17
-15.35 186.40 98 4.4 17
-18.69 169.10 218 4.2 27
-18.89 181.24 655 4.1 14
-17.61 183.32 356 4.2 15
-20.93 181.54 564 5.0 64
-17.60 181.50 548 4.1 10
-17.96 181.40 655 4.3 20
-18.80 182.41 385 5.2 67
-20.61 182.44 518 4.2 10
-20.74 181.53 598 4.5 36
-25.23 179.86 476 4.4 29
-23.90 179.90 579 4.4 16
-18.07 181.58 603 5.0 65
-15.43 185.19 249 4.0 11
-14.30 167.32 208 4.8 25
-18.04 181.57 587 5.0 51
-13.90 167.18 221 4.2 21
-17.64 177.01 545 5.2 91
-17.98 181.51 586 5.2 68
-25.00 180.00 488 4.5 10
-19.45 184.48 246 4.3 15
-16.11 187.48 61 4.5 19
-23.73 179.98 524 4.6 11
-17.74 186.78 104 5.1 71
-21.56 183.23 271 4.4 36
-20.97 181.72 487 4.3 16
-15.45 186.73 83 4.7 37
-15.93 167.91 183 5.6 109
-21.47 185.86 55 4.9 46
-21.44 170.45 166 5.1 22
-22.16 180.49 586 4.6 13
-13.36 172.76 618 4.4 18
-21.22 181.51 524 4.8 49
-26.10 182.50 133 4.2 17
-18.35 185.27 201 4.7 57
-17.20 182.90 383 4.1 11
-22.42 171.40 86 4.7 33
-17.91 181.48 555 4.0 17
-26.53 178.30 605 4.9 43
-26.50 178.29 609 5.0 50
-16.31 168.08 204 4.5 16
-18.76 169.71 287 4.4 23
-17.10 182.80 390 4.0 14
-19.28 182.78 348 4.5 30
-23.50 180.00 550 4.7 23
-21.26 181.69 487 4.4 20
-17.97 181.48 578 4.7 43
-26.02 181.20 361 4.7 32
-30.30 180.80 275 4.0 14
-24.89 179.67 498 4.2 14
-14.57 167.24 162 4.5 18
-15.40 186.87 78 4.7 44
-22.06 183.95 134 4.5 17
-25.14 178.42 554 4.1 15
-20.30 181.40 608 4.6 13
-25.28 181.17 367 4.3 25
-20.63 181.61 599 4.6 30
-19.02 186.83 45 5.2 65
-22.10 185.30 50 4.6 22
-38.59 175.70 162 4.7 36
-19.30 183.00 302 5.0 65
-31.03 181.59 57 5.2 49
-30.51 181.30 203 4.4 20
-22.55 183.34 66 4.6 18
-22.14 180.64 591 4.5 18
-25.60 180.30 440 4.0 12
-18.04 181.84 611 4.2 20
-21.29 185.77 57 5.3 69
-21.08 180.85 627 5.9 119
-20.64 169.66 89 4.9 42
-24.41 180.03 500 4.5 34
-12.16 167.03 264 4.4 14
-17.10 185.90 127 5.4 75
-21.13 185.60 85 5.3 86
-12.34 167.43 50 5.1 47
-16.43 186.73 75 4.1 20
-20.70 184.30 182 4.3 17
-21.18 180.92 619 4.5 18
-17.78 185.33 223 4.1 10
-21.57 183.86 156 5.1 70
-13.70 166.75 46 5.3 71
-12.27 167.41 50 4.5 29
-19.10 184.52 230 4.1 16
-19.85 184.51 184 4.4 26
-11.37 166.55 188 4.7 24
-20.70 186.30 80 4.0 10
-20.24 185.10 86 5.1 61
-16.40 182.73 391 4.0 16
-19.60 184.53 199 4.3 21
-21.63 180.77 592 4.3 21
-21.60 180.50 595 4.0 22
-21.77 181.00 618 4.1 10
-21.80 183.60 213 4.4 17
-21.05 180.90 616 4.3 10
-10.80 165.80 175 4.2 12
-17.90 181.50 589 4.0 12
-22.26 171.44 83 4.5 25
-22.33 171.46 119 4.7 32
-24.04 184.85 70 5.0 48
-20.40 186.10 74 4.3 22
-15.00 184.62 40 5.1 54
-27.87 183.40 87 4.7 34
-14.12 166.64 63 5.3 69
-23.61 180.27 537 5.0 63
-21.56 185.50 47 4.5 29
-21.19 181.58 490 5.0 77
-18.07 181.65 593 4.1 16
-26.00 178.43 644 4.9 27
-20.21 181.90 576 4.1 16
-28.00 182.00 199 4.0 16
-20.74 180.70 589 4.4 27
-31.80 180.60 178 4.5 19
-18.91 169.46 248 4.4 33
-20.45 182.10 500 4.5 37
-22.90 183.80 71 4.3 19
-18.11 181.63 568 4.3 36
-23.80 184.70 42 5.0 36
-23.42 180.21 510 4.5 37
-23.20 184.80 97 4.5 13
-12.93 169.52 663 4.4 30
-21.14 181.06 625 4.5 35
-19.13 184.97 210 4.1 22
-21.08 181.30 557 4.9 78
-20.07 181.75 582 4.7 27
-20.90 182.02 402 4.3 18
-25.04 179.84 474 4.6 32
-21.85 180.89 577 4.6 43
-19.34 186.59 56 5.2 49
-15.83 167.10 43 4.5 19
-23.73 183.00 118 4.3 11
-18.10 181.72 544 4.6 52
-22.12 180.49 532 4.0 14
-15.39 185.10 237 4.5 39
-16.21 186.52 111 4.8 30
-21.75 180.67 595 4.6 30
-22.10 180.40 603 4.1 11
-24.97 179.54 505 4.9 50
-19.36 186.36 100 4.7 40
-22.14 179.62 587 4.1 23
-21.48 182.44 364 4.3 20
-18.54 168.93 100 4.4 17
-21.62 182.40 350 4.0 12
-13.40 166.90 228 4.8 15
-15.50 185.30 93 4.4 25
-15.67 185.23 66 4.4 34
-21.78 183.11 225 4.6 21
-30.63 180.90 334 4.2 28
-15.70 185.10 70 4.1 15
-19.20 184.37 220 4.2 18
-19.70 182.44 397 4.0 12
-19.40 182.29 326 4.1 15
-15.85 185.90 121 4.1 17
-17.38 168.63 209 4.7 29
-24.33 179.97 510 4.8 44
-20.89 185.26 54 5.1 44
-18.97 169.44 242 5.0 41
-17.99 181.62 574 4.8 38
-15.80 185.25 82 4.4 39
-25.42 182.65 102 5.0 36
-21.60 169.90 43 5.2 56
-26.06 180.05 432 4.2 19
-17.56 181.23 580 4.1 16
-25.63 180.26 464 4.8 60
-25.46 179.98 479 4.5 27
-22.23 180.48 581 5.0 54
-21.55 181.39 513 5.1 81
-15.18 185.93 77 4.1 16
-13.79 166.56 68 4.7 41
-15.18 167.23 71 5.2 59
-18.78 186.72 68 4.8 48
-17.90 181.41 586 4.5 33
-18.50 185.40 243 4.0 11
-14.82 171.17 658 4.7 49
-15.65 185.17 315 4.1 15
-30.01 181.15 210 4.3 17
-13.16 167.24 278 4.3 17
-21.03 180.78 638 4.0 14
-21.40 180.78 615 4.7 51
-17.93 181.89 567 4.1 27
-20.87 181.70 560 4.2 13
-12.01 166.66 99 4.8 36
-19.10 169.63 266 4.8 31
-22.85 181.37 397 4.2 15
-17.08 185.96 180 4.2 29
-21.14 174.21 40 5.7 78
-12.23 167.02 242 6.0 132
-20.91 181.57 530 4.2 20
-11.38 167.05 133 4.5 32
-11.02 167.01 62 4.9 36
-22.09 180.58 580 4.4 22
-17.80 181.20 530 4.0 15
-18.94 182.43 566 4.3 20
-18.85 182.20 501 4.2 23
-21.91 181.28 548 4.5 30
-22.03 179.77 587 4.8 31
-18.10 181.63 592 4.4 28
-18.40 184.84 221 4.2 18
-21.20 181.40 560 4.2 12
-12.00 166.20 94 5.0 31
-11.70 166.30 139 4.2 15
-26.72 182.69 162 5.2 64
-24.39 178.98 562 4.5 30
-19.64 169.50 204 4.6 35
-21.35 170.04 56 5.0 22
-22.82 184.52 49 5.0 52
-38.28 177.10 100 5.4 71
-12.57 167.11 231 4.8 28
-22.24 180.28 601 4.2 21
-13.80 166.53 42 5.5 70
-21.07 183.78 180 4.3 25
-17.74 181.25 559 4.1 16
-23.87 180.15 524 4.4 22
-21.29 185.80 69 4.9 74
-22.20 180.58 594 4.5 45
-15.24 185.11 262 4.9 56
-17.82 181.27 538 4.0 33
-32.14 180.00 331 4.5 27
-19.30 185.86 48 5.0 40
-33.09 180.94 47 4.9 47
-20.18 181.62 558 4.5 31
-17.46 181.42 524 4.2 16
-17.44 181.33 545 4.2 37
-24.71 179.85 477 4.2 34
-21.53 170.52 129 5.2 30
-19.17 169.53 268 4.3 21
-28.05 182.39 117 5.1 43
-23.39 179.97 541 4.6 50
-22.33 171.51 112 4.6 14
-15.28 185.98 162 4.4 36
-20.27 181.51 609 4.4 32
-10.96 165.97 76 4.9 64
-21.52 169.75 61 5.1 40
-19.57 184.47 202 4.2 28
-23.08 183.45 90 4.7 30
-25.06 182.80 133 4.0 14
-17.85 181.44 589 5.6 115
-15.99 167.95 190 5.3 81
-20.56 184.41 138 5.0 82
-17.98 181.61 598 4.3 27
-18.40 181.77 600 4.1 11
-27.64 182.22 162 5.1 67
-20.99 181.02 626 4.5 36
-14.86 167.32 137 4.9 22
-29.33 182.72 57 5.4 61
-25.81 182.54 201 4.7 40
-14.10 166.01 69 4.8 29
-17.63 185.13 219 4.5 28
-23.47 180.21 553 4.2 23
-23.92 180.21 524 4.6 50
-20.88 185.18 51 4.6 28
-20.25 184.75 107 5.6 121
-19.33 186.16 44 5.4 110
-18.14 181.71 574 4.0 20
-22.41 183.99 128 5.2 72
-20.77 181.16 568 4.2 12
-17.95 181.73 583 4.7 57
-20.83 181.01 622 4.3 15
-27.84 182.10 193 4.8 27
-19.94 182.39 544 4.6 30
-23.60 183.99 118 5.4 88
-23.70 184.13 51 4.8 27
-30.39 182.40 63 4.6 22
-18.98 182.32 442 4.2 22
-27.89 182.92 87 5.5 67
-23.50 184.90 61 4.7 16
-23.73 184.49 60 4.7 35
-17.93 181.62 561 4.5 32
-35.94 178.52 138 5.5 78
-18.68 184.50 174 4.5 34
-23.47 179.95 543 4.1 21
-23.49 180.06 530 4.0 23
-23.85 180.26 497 4.3 32
-27.08 183.44 63 4.7 27
-20.88 184.95 82 4.9 50
-20.97 181.20 605 4.5 31
-21.71 183.58 234 4.7 55
-23.90 184.60 41 4.5 22
-15.78 167.44 40 4.8 42
-12.57 166.72 137 4.3 20
-19.69 184.23 223 4.1 23
-22.04 183.95 109 5.4 61
-17.99 181.59 595 4.1 26
-23.50 180.13 512 4.8 40
-21.40 180.74 613 4.2 20
-15.86 166.98 60 4.8 25
-23.95 184.64 43 5.4 45
-25.79 182.38 172 4.4 14
-23.75 184.50 54 5.2 74
-24.10 184.50 68 4.7 23
-18.56 169.05 217 4.9 35
-23.30 184.68 102 4.9 27
-17.03 185.74 178 4.2 32
-20.77 183.71 251 4.4 47
-28.10 183.50 42 4.4 17
-18.83 182.26 575 4.3 11
-23.00 170.70 43 4.9 20
-20.82 181.67 577 5.0 67
-22.95 170.56 42 4.7 21
-28.22 183.60 75 4.9 49
-27.99 183.50 71 4.3 22
-15.54 187.15 60 4.5 17
-12.37 166.93 291 4.2 16
-22.33 171.66 125 5.2 51
-22.70 170.30 69 4.8 27
-17.86 181.30 614 4.0 12
-16.00 184.53 108 4.7 33
-20.73 181.42 575 4.3 18
-15.45 181.42 409 4.3 27
-20.05 183.86 243 4.9 65
-17.95 181.37 642 4.0 17
-17.70 188.10 45 4.2 10
-25.93 179.54 470 4.4 22
-12.28 167.06 248 4.7 35
-20.13 184.20 244 4.5 34
-17.40 187.80 40 4.5 14
-21.59 170.56 165 6.0 119

This dataset includes 1000 records of earthquakes and their location on the globe. If we wanted to plot all of them at once, it would be overwhelming.

Basic Summary Statistics

As we did before, let’s look some basic summaries of this new dataset. The summary function breaks data into quantiles, but quantile does this a bit cleaner without mean in the middle:

summary(quakes$mag)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    4.00    4.30    4.60    4.62    4.90    6.40
quantile(quakes$mag)
##   0%  25%  50%  75% 100% 
##  4.0  4.3  4.6  4.9  6.4

As you can see, the majority of earthquakes have a magnitude below 5. If we wanted to plot earthquakes on a map, we may want a way to differentiate them based on their magnitude. We can do this via binning.

Binning data

Using the new function qunatile, let’s break up the quake data based on magnitude and add this new vector to the dataset quakes:

quakes$quant=cut(quakes$mag,breaks=quantile(quakes$mag),labels=F,include.lowest=T)
head(quakes)
##      lat   long depth mag stations quant
## 1 -20.42 181.62   562 4.8       41     3
## 2 -20.62 181.03   650 4.2       15     1
## 3 -26.00 184.10    42 5.4       43     4
## 4 -17.97 181.66   626 4.1       19     1
## 5 -20.42 181.96   649 4.0       11     1
## 6 -19.68 184.31   195 4.0       12     1
#View(quakes)

Because we split the data into quantiles, there should be roughly the same number in each group. At your table, verify this is in fact true. How many data points are in each quantile?

Binning data and adding character labels

Rather than have your data labeled 1-4, you may be interested in a more specific labeling scheme. Here, I am going to assign color values to each category with the lowest magnitude having grey value and the highest category having red value.

quakes$color=as.character(cut(quakes$mag,breaks=quantile(quakes$mag),labels=c("grey50","yellow","orange","red"),include.lowest=T))

Check out maps

Take a few minutes to read over the documentation for this new package.

??maps

Plotting quakes on a map

We will use the function map. First, let’s examine the range of latitude and longitude values in this dataset:

range(quakes$lat)
## [1] -38.59 -10.72
range(quakes$long)
## [1] 165.67 188.13

Plotting quakes on a map

Let’s use the world map to project these earthquakes. We’ll initialize a map and add points from our dataset. Note we’ve specified the limits of the plot according to our data, but added a bit of a buffer. This allows us to zoom out a bit to see where we are. Feel free to make your own adjustments here:

maps::map('world', xlim=c(min(quakes$long)-30,max(quakes$long)+30),ylim=c(min(quakes$lat)-15,max(quakes$lat)+15))
points(quakes$long,quakes$lat,pch=19)

Adjusting plot based on our bins

Finally, let’s use adjust how these data are plotted based on the quantile bins we made earlier:

#use color value to mark magnitude
maps::map('world',xlim=c(min(quakes$long)-35,max(quakes$long)+15),ylim=c(min(quakes$lat)-15,max(quakes$lat)+5))
points(quakes$long,quakes$lat,col=quakes$color,pch=19)

#use quantile value to adjust size of each point according to magnitude
maps::map('world',xlim=c(min(quakes$long)-35,max(quakes$long)+15),ylim=c(min(quakes$lat)-15,max(quakes$lat)+5))
points(quakes$long,quakes$lat,col=quakes$color,pch=19,cex=0.5*quakes$quant)