From 4d72c6aca6b2cc2ec75ffa3f0b3a3334d3a3b56e Mon Sep 17 00:00:00 2001 From: petr-pavlik Date: Wed, 27 Nov 2024 11:22:01 +0100 Subject: [PATCH] fix figures --- 04_interpolation.qmd | 131 +- docs/01_R.html | 56 +- docs/02_statistics.html | 24 +- docs/03_gis.html | 24 +- docs/04_interpolation.html | 129 +- .../figure-html/unnamed-chunk-1-1.svg | 342 +- .../figure-html/unnamed-chunk-2-1.svg | 1304 +- .../figure-html/unnamed-chunk-5-1.svg | 20535 +++++++--------- .../figure-html/unnamed-chunk-6-1.svg | 1288 +- .../figure-html/unnamed-chunk-8-1.svg | 1308 +- docs/search.json | 6 +- 11 files changed, 10799 insertions(+), 14348 deletions(-) diff --git a/04_interpolation.qmd b/04_interpolation.qmd index 07f0a2e..4fa0194 100644 --- a/04_interpolation.qmd +++ b/04_interpolation.qmd @@ -79,7 +79,7 @@ plot(x = st_geometry(grid), lwd = 0.1, add = TRUE, reset = TRUE) # <2> Now we compute the distances between the points using the `outer()` function -```{r, eval=TRUE, fig.align='center', fig.cap=''} +```{r, eval=TRUE, fig.align='center'} distances <- sapply(1:nrow(st_coordinates(grid)), function(i) { sqrt((st_coordinates(grid)[i, "X"] - st_coordinates(dom)[, "X"])^2 + (st_coordinates(grid)[i, "Y"] - st_coordinates(dom)[, "Y"])^2) @@ -151,7 +151,7 @@ plot(x = join, There are many libraries listed in CRAN **geostatistics** task view. One of these is called gstat, it was developed and is maintained by Edzer Pebesma, who is also behind the `raster` and `terra` packages. The gstat package contains functions no olny for interpolations. -```{r, eval=TRUE} +```{r, eval=TRUE, fig.align='center'} library(gstat) idw_res <- gstat::idw(formula = value ~ 1, locations = dom, @@ -186,7 +186,7 @@ weighted_sum Another interpolation technique is called **Krigging**. Opposing to the Inverse Distance Weighted method. -```{r, eval=TRUE} +```{r, eval=TRUE, fig.align='center'} projected_crs <- 32633 # Replace with the appropriate UTM zone for your data @@ -247,128 +247,3 @@ plot( ) ``` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docs/01_R.html b/docs/01_R.html index e90e44b..68d3d02 100644 --- a/docs/01_R.html +++ b/docs/01_R.html @@ -340,19 +340,19 @@

1
-General sequence of numbers +General sequence of numbers
2
-change some elements to not assigned +change some elements to not assigned
3
-without removal +without removal
4
-and with removal +and with removal
@@ -628,12 +628,12 @@

1
-Example of function, which seeks the neares number from a vector x to a certain referential value. +Example of function, which seeks the neares number from a vector x to a certain referential value.
-
Hodnota nejblíže 0 z vektoru x je: 0.04803224
+
Hodnota nejblíže 0 z vektoru x je: -0.01590373

We can test if we get the same result as the primitive function from R using all.equal() statement.

@@ -810,15 +810,15 @@

Vectors

1
-Adding two vectors while length of second is the multiple of the first +Adding two vectors while length of second is the multiple of the first
2
-Multiplying two vectors while length of second is the multiple of the first +Multiplying two vectors while length of second is the multiple of the first
3
-Multipling with single numeric value +Multipling with single numeric value
@@ -849,35 +849,35 @@
Working wi
1
-Vector creation \(\boldsymbol{\mathrm{x}}\) by different approaches. Sequences, repeats, repetitions and sampling +Vector creation \(\boldsymbol{\mathrm{x}}\) by different approaches. Sequences, repeats, repetitions and sampling
2
-Transposition of vector. +Transposition of vector.
3
-Naming elements of a vector. +Naming elements of a vector.
4
-Selection of elements from a vector based on a condition. +Selection of elements from a vector based on a condition.
5
-Selection of elements from a vector based on an index. +Selection of elements from a vector based on an index.
-
         [,1]     [,2]     [,3]     [,4]     [,5]     [,6]     [,7]     [,8]
-[1,] 96.97616 834.4318 707.3374 1212.165 1288.363 16.33978 315.1559 608.6296
+
         [,1]    [,2]     [,3]     [,4]     [,5]    [,6]     [,7]     [,8]
+[1,] 110.3749 5.84625 693.2721 147.1503 9.649926 1766.76 7.561956 1.109624
          [,9]    [,10]
-[1,] 22.63338 199.5815
-        D         E         F         H         I 
-34.816167 35.893779  4.042249 24.670419  4.757455 
+[1,] 148.2652 0.350399
+         A          B          E          F          G          I          J 
+10.5059478  2.4179021  3.1064330 42.0328426  2.7499010 12.1764216  0.5919451 
          A          B          C 
- -9.847647 -28.886533 -26.595815 
+ 10.505948 2.417902 -26.330061
@@ -953,7 +953,7 @@

Matrices an
1
-Conversion to \(2\times 2\) dimension +Conversion to \(2\times 2\) dimension

@@ -972,9 +972,9 @@

Matrices an M[c(1,3), 1:2] <- rnorm(2) # store random numbers to first two rows colMeans(M) -## [1] 1.4745562 0.5745562 +## [1] 0.88685608 -0.01314392 rowSums(M) -## [1] 3.704401 1.500000 2.041160 1.500000 1.500000 +## [1] -1.837653 1.500000 1.706214 1.500000 1.500000

It is possible to have matrices containing any data type, e.g.

@@ -1080,7 +1080,7 @@

if()
1
-The chain of conditions will close at the first evaluation which happens to be TRUE. +The chain of conditions will close at the first evaluation which happens to be TRUE.
@@ -1119,11 +1119,11 @@

switch()
1
-“A” variant did not happen, +“A” variant did not happen,
2
-instead the “B” variant is truthful, so the expression is evaluated as \(2\cdot 3 = 6\) +instead the “B” variant is truthful, so the expression is evaluated as \(2\cdot 3 = 6\)
@@ -1237,11 +1237,11 @@

repeat
1
-Execute in loop, +Execute in loop,
2
-if a condition is met, break stops the cycle. +if a condition is met, break stops the cycle.
diff --git a/docs/02_statistics.html b/docs/02_statistics.html index 924f5da..bff1ff9 100644 --- a/docs/02_statistics.html +++ b/docs/02_statistics.html @@ -285,11 +285,11 @@

1
-Using the set seed will ensure that we will get the same generated numbers every time. +Using the set seed will ensure that we will get the same generated numbers every time.
2
-Some random-generated numbers from the Normal distribution. +Some random-generated numbers from the Normal distribution.
@@ -508,27 +508,27 @@

1
-This file is stored locally as part of this site. You have to change to your path. +This file is stored locally as part of this site. You have to change to your path.
2
-Load the data in fixed width format using the read.fwf() function. +Load the data in fixed width format using the read.fwf() function.
3
-Provide variable names, since there aren’t any. +Provide variable names, since there aren’t any.
4
-Now there is a trouble with dates. If you evaluate sequentially, you could see that the date format expects “YYYY-mm-dd” format, we have to fill the blank spots with zeroes to comply. +Now there is a trouble with dates. If you evaluate sequentially, you could see that the date format expects “YYYY-mm-dd” format, we have to fill the blank spots with zeroes to comply.
5
-After that, some variables contain non-physical values like -9999, these would make troubles in statistical processing, we have to replace them with NA (not assigned). +After that, some variables contain non-physical values like -9999, these would make troubles in statistical processing, we have to replace them with NA (not assigned).
6
-Let’s display the 5 first and 5 last rows of the result. +Let’s display the 5 first and 5 last rows of the result.
@@ -575,7 +575,7 @@

1
-With the help of special characters we are extracting the years and months consecutively. +With the help of special characters we are extracting the years and months consecutively.
@@ -612,7 +612,7 @@

1
-The hydrological year in Czechia is defined from \(1^{\mathrm{st}}\) November to \(31^{\mathrm{st}}\) October next year. +The hydrological year in Czechia is defined from \(1^{\mathrm{st}}\) November to \(31^{\mathrm{st}}\) October next year.
@@ -724,11 +724,11 @@

1
-Create the empirical cumulative distribution function (ECDF) for the data. +Create the empirical cumulative distribution function (ECDF) for the data.
2
-Calculate percent of data lower than 35. +Calculate percent of data lower than 35.
diff --git a/docs/03_gis.html b/docs/03_gis.html index 80fd5f3..8f2f6ee 100644 --- a/docs/03_gis.html +++ b/docs/03_gis.html @@ -299,27 +299,27 @@

1
-Load the Whitebox API package. +Load the Whitebox API package.
2
-Load the terra package for raster use. +Load the terra package for raster use.
3
-Load the sf package for vector use. +Load the sf package for vector use.
4
-Load the ggplot2 plotting functions for layers. +Load the ggplot2 plotting functions for layers.
5
-Load the tidyterra for the terra objects and ggplot2 compatibility. +Load the tidyterra for the terra objects and ggplot2 compatibility.
6
-Load scientific colors library. +Load scientific colors library.
@@ -339,11 +339,11 @@

5
-Whitebox needs the information where the data executable is stored. +Whitebox needs the information where the data executable is stored.
6
-Binary check. Returns TRUE if found. +Binary check. Returns TRUE if found.
@@ -363,11 +363,11 @@

1
-Use the rast() function to load the data +Use the rast() function to load the data
2
-Plot via the tmap workflow +Plot via the tmap workflow
@@ -418,11 +418,11 @@

1
-This algorithm involves removing flat areas and filling depressions, thus producing hydrologically corrected DEM +This algorithm involves removing flat areas and filling depressions, thus producing hydrologically corrected DEM
2
-Pointer is https://www.researchgate.net/publication/333193489/figure/fig14/AS:941786386149402@1601550780863/Sketch-map-of-D8-algorithm-a-direction-coding-of-D8-algorithm-b-sample-elevation.png +Pointer is https://www.researchgate.net/publication/333193489/figure/fig14/AS:941786386149402@1601550780863/Sketch-map-of-D8-algorithm-a-direction-coding-of-D8-algorithm-b-sample-elevation.png
diff --git a/docs/04_interpolation.html b/docs/04_interpolation.html index 1c125e4..f2f594f 100644 --- a/docs/04_interpolation.html +++ b/docs/04_interpolation.html @@ -276,15 +276,15 @@

1
-Create \(25\) points with random values, which will serve as the computation origin, +Create \(25\) points with random values, which will serve as the computation origin,
2
-store them as SimpleFeatures object with coordinate reference system via EPSG, search in https://epsg.io +store them as SimpleFeatures object with coordinate reference system via EPSG, search in https://epsg.io
3
-Specify sf:::plot.sf() function and use scientific colormaps from scico package. +Specify sf:::plot.sf() function and use scientific colormaps from scico package.
@@ -322,11 +322,11 @@

1
-Construct a regular grid using extreme points as boundary limits. +Construct a regular grid using extreme points as boundary limits.
2
-Plot with the points. +Plot with the points.
@@ -423,7 +423,7 @@

5.2 gstat

There are many libraries listed in CRAN geostatistics task view. One of these is called gstat, it was developed and is maintained by Edzer Pebesma, who is also behind the raster and terra packages. The gstat package contains functions no olny for interpolations.

-
+
Code
library(gstat)
@@ -462,7 +462,11 @@

reset = FALSE)

-

+
+
+

+
+
@@ -477,7 +481,7 @@

5.3 Krigging

Another interpolation technique is called Krigging. Opposing to the Inverse Distance Weighted method.

-
+
Code
projected_crs <- 32633  # Replace with the appropriate UTM zone for your data
@@ -502,7 +506,7 @@ 

) combined_points <- st_transform(combined_points, crs = projected_crs) -variogram <- vgm(psill = 0.05, model = "Mat", range = 10000, nugget = 0.15) +variogram <- vgm(psill = 0.05, model = "Mat", range = 300000, nugget = 0.15) krig_res <- gstat::krige( formula = value ~ 1, @@ -550,110 +554,13 @@

)

-

+
+
+

+
+
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docs/04_interpolation_files/figure-html/unnamed-chunk-1-1.svg b/docs/04_interpolation_files/figure-html/unnamed-chunk-1-1.svg index 8f454e7..7370fb2 100644 --- a/docs/04_interpolation_files/figure-html/unnamed-chunk-1-1.svg +++ b/docs/04_interpolation_files/figure-html/unnamed-chunk-1-1.svg @@ -6,29 +6,26 @@ - + - + - + - + - + - - + - - @@ -41,23 +38,21 @@ + - - - - + - + - + @@ -112,79 +107,79 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -193,297 +188,270 @@ - + - + - + - + - + - + - + - - - - - - - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - + + + + + + - + - + - + - + + + + - + - + - + - + - + - + - + - - - - - - - + - - - - - - + + + + + - - + + - + - + + - - + - + - - + + - + - + - - + + - + - + + + + + + - - + + - + - - - - - - - - - - - + - + + - - + - + - + + - - + - + - + + - - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/04_interpolation_files/figure-html/unnamed-chunk-2-1.svg b/docs/04_interpolation_files/figure-html/unnamed-chunk-2-1.svg index f3507ce..7e253f6 100644 --- a/docs/04_interpolation_files/figure-html/unnamed-chunk-2-1.svg +++ b/docs/04_interpolation_files/figure-html/unnamed-chunk-2-1.svg @@ -6,29 +6,26 @@ - + - + - + - + - + - - + - - @@ -41,23 +38,21 @@ + - - - - + - + - + @@ -190,34 +185,28 @@ - + - + - + - + - + - + - + - - - - - - - + @@ -296,188 +285,167 @@ - - - - - + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - + - - - - - - + + + + + - - + + - + - + + - - + - + - - + + - + - + - - + + - + - + + + + + + - - + + - + - - - - - - - - - - - + - + + - - + - + - + + - - + - + - + + - - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -498,604 +466,466 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/04_interpolation_files/figure-html/unnamed-chunk-5-1.svg b/docs/04_interpolation_files/figure-html/unnamed-chunk-5-1.svg index 89b12cc..2bded51 100644 --- a/docs/04_interpolation_files/figure-html/unnamed-chunk-5-1.svg +++ b/docs/04_interpolation_files/figure-html/unnamed-chunk-5-1.svg @@ -6,24 +6,24 @@ - + - + - + - + - - + + @@ -38,28 +38,23 @@ + - - - - + - + - + - - - @@ -190,37 +185,28 @@ - + - + - + - + - + - + - + - - - - - - - - - - + @@ -299,11688 +285,8953 @@ - - - - + + + + + + + + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - - + + - + - + + - - + - + - + + - - - - - - - - - + - + - - + + - + - + + + + + + - - + + - + - + - - + + - + - + - - + + - + - + - - + + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/04_interpolation_files/figure-html/unnamed-chunk-6-1.svg b/docs/04_interpolation_files/figure-html/unnamed-chunk-6-1.svg index c9ec98e..5a993f5 100644 --- a/docs/04_interpolation_files/figure-html/unnamed-chunk-6-1.svg +++ b/docs/04_interpolation_files/figure-html/unnamed-chunk-6-1.svg @@ -6,26 +6,29 @@ - + - + - + - + - + + + + @@ -38,28 +41,23 @@ + - - - - + - + - + - - - @@ -190,37 +188,28 @@ - + - + - + - + - + - + - + - - - - - - - - - - + @@ -299,773 +288,620 @@ - - - - + + + + + + + - + + + - + + + - + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - - - - - - - - - - + - - - - - - - - - - - - - - - - + + + + + - - + + - + - - + + - + - + - - + + - + - + - - + + - - - - - - - - - - - - - - - + - + + + + + + - - + + - + - + - - + + - + - + - - + + - + - + - - + + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/04_interpolation_files/figure-html/unnamed-chunk-8-1.svg b/docs/04_interpolation_files/figure-html/unnamed-chunk-8-1.svg index 10a21fe..8e034d7 100644 --- a/docs/04_interpolation_files/figure-html/unnamed-chunk-8-1.svg +++ b/docs/04_interpolation_files/figure-html/unnamed-chunk-8-1.svg @@ -6,38 +6,29 @@ - + - + - + - + - + - + - - - - - - - - - @@ -50,28 +41,23 @@ + - - - - + - + - + - - - @@ -202,37 +188,28 @@ - + - + - + - + - + - + - + - - - - - - - - - - + @@ -311,801 +288,608 @@ - - - - - - - - - - - - - + + + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - + - + - + - + - + - + - + - - - - - - - - - - + - - - - - - + + + + + - - + + - + - + + - - + - + - - + + - + - + - - + + - + - + + + + + + - - + + - - - - - - - - - - - - - - - + - + - - + + - + - + - - + + - + - + - - + + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/search.json b/docs/search.json index 6e652f2..a3e8ac3 100644 --- a/docs/search.json +++ b/docs/search.json @@ -32,7 +32,7 @@ "href": "01_R.html#r-as-programming-language", "title": "2  Introduction to R language", "section": "2.3 R as programming language", - "text": "2.3 R as programming language\n\n2.3.1 Variables and name conventions\nIt is highly discouraged using spaces and diacritical marks in naming, like the Czech translation of the term “variable” - proměnná. Most programmers use either camelNotation or snake_notation for naming purposes. Obviously the R is case-sensitive so camelNotation and CamelNotation are two different things. Variables do not contain spaces, quotes, arithmetical, logical nor relational operators neither they contain special characters like =, -, ``. Objects cannot be named by key words.\n\nKey words\nif, else, repeat, while, function, for, in, next, repeat, break, TRUE, FALSE, NULL, Inf, NaN, NA, NA_integer_, NA_real_, NA_complex_, NA_character_\nIt is not recommended to inlude dot in the name, like morava.prutoky, and to match the names with commonly used functions. R is “case-sensitive” which means, that X does not equal x.\n\n\nExercise\nIntuitively, we might be guided to load the data into the data variable. This is the wrong however, since data() is a function to access datasets that are part of the basic R installation. Try it out.\n\n\nSome cases of possible but wrong naming\naaa, Morávka průtok [m/s], moje.proměnná\n\n\n\n\n2.3.2 Rules of quotation marks and parenthesses\nBoth represent the paired characters in R. Parenthesses are used in three versions: classical, square brackets and curly brackets (braces). All of them have specific non-overlaping usage.\n\n() are always to be found right next to a function name they delineate the space where function arguments are to be specified.\n\n[] are always use with the name of the object (vector, array, list, …) and signalize subselecting from the object.\n\n{} mark a block of code, which should be executed at once.\n\n\nQuotation marks introduce text strings. Both “double” and ‘single’ quotes can be used completely at will, they just need to be closed with the same type. Back quotes are also common and are used, for example, to delimit a non-standard column name in a structure.\n\n\n2.3.3 Functions\nYou can define own functions using the function() construct. If you work in ****RStudio, just type fun and tabulate a snippet from the IDE help. The action produces {(code-function-snippet?)}.\n\n\nCode\nname <- function(variables) {\n ...\n}\n\n\nname is the name of the function we would like to create and variables are the arguments of that function. Space between the {and } is called a body of a function and contains all the computation which is invoked when the function is called.\nLet’s put Here an example of creating own function to calculate weighted mean\n\\[\n\\bar{x} = \\dfrac{\\sum\\limits_{i=1}^{n} w_ix_i}{\\sum\\limits_{i=1}^{n}w_i},\n\\] where \\(x_iw_i\\) are the individual weighted measurements.\nWe define a simple function for that purpose and run an example.\n\n\nCode\nw_mean <- function(x, w = 1/length(x)) {\n sum(x*w)/sum(w)\n}\nw_mean(1:10)\n\n\n[1] 55\n\n\nHere is a different example:\n\n\nCode\nx <- rnorm(100)\n1nejblizsi_hodnota <- function(x, value) {\n x[which(abs(x - value) == min(abs(x - value)))]\n}\n\ncat(\"Hodnota nejblíže 0 z vektoru x je:\" , nejblizsi_hodnota(x = x, value = 0))\n\n\n\n1\n\nExample of function, which seeks the neares number from a vector x to a certain referential value.\n\n\n\n\nHodnota nejblíže 0 z vektoru x je: 0.04803224\n\n\nWe can test if we get the same result as the primitive function from R using all.equal() statement.\n\n\nCode\nall.equal(w_mean(x = 1:5, w = c(0.25, 0.25, 1, 2, 3)), \n weighted.mean(x = 1:5, w = c(0.25, 0.25, 1, 2, 3)))\n\n\n[1] TRUE\n\n\nAny argument without default value in the function definition has to be provided on function call. You can frequently see functions with the possibility to specify ... a so-called three dot construct or ellipsis. The ellipsis allows for adding any number of arguments to a function call, after all the named ones.\n\n\n2.3.4 Data types\nThe basic types are logical, integer, numeric, complex, character and raw. There are some additional types which we will encounter like Date. Since R is dynamically typed, it is not necessary for the user to declare variables before using them. Also the type changes without notice based on the stored values, where the chain goes from the least complex to the most. The summary is in the following table\n\n\nCode\nTRUE # logical, also T as short version\n## [1] TRUE\n1L # integer\n## [1] 1\n1.2 # numeric\n## [1] 1.2\n1+3i # complex\n## [1] 1+3i\n\"A\" # character, also 'A'\n## [1] \"A\"\n\n\nThey represent the individual elements of data structures. R dynamically typed and does not require declarations before usage.\n\nBasic types and coercions.\n\n\n\n\n\n\n\n\n\n\n\nlogical\ninteger\nnumeric\ncomplex\ncharacter\n\n\n\n\nlogical\nlogical\ninteger\nnumeric\ncomplex\ncharacter\n\n\ninteger\nlogical\ninteger\nnumeric\ncomplex\ncharacter\n\n\nnumeric\nlogical\nnumeric\nnumeric\ncomplex\ncharacter\n\n\ncomplex\nlogical\ninteger + warning\nnumeric + warning\ncomplex\ncharacter\n\n\ncharacter\nNA_logical\nNA_integer + warning\nNA_numeric + warning\nNA_complex + warning\ncharacter\n\n\n\nTwo types of functions are connected to data types: is.___ a as.___. Is is either questioning or coertion of data type. Try also class(), mode().\n\n\nCode\nis.character(\"ABC\")\n\n\n[1] TRUE\n\n\nCode\nas.integer(11 + 1i)\n\n\nWarning: imaginary parts discarded in coercion\n\n\n[1] 11\n\n\n\n\n\n\n\n\nExercise\n\n\n\n\nCreate in any way a vector x of 10 different numerical values, where \\(x\\in\\mathbb{R}\\).\nWrite an expression to select numbers between -5 and 5 from this vector.\nConvert to integer type and discuss the result.\nAdd 3 positions “A”, “B” and “C” to the vector, has the vector changed?\n\n\n\n\n\n2.3.5 Data structures\n\nVectors\nAtomic vectors are single-type linear structures. They can contain elements of any type, from logical, integer, numeric, complex, character. A vector is a basic building structure in the R language, there is nothing like a scalar quantity here. The concept of vector is understood here in the mathematical sense as a vector of values representing a point in \\(n\\)-dimensional space.\n\\[\n\\mathbf{\\mathrm{u}} =\n\\begin{pmatrix}\n1\\\\\n1.5\\\\\n-14\\\\\n7.223\\\\\n\\end{pmatrix}, \\qquad\n\\mathbf{\\mathrm{v}} =\n\\begin{pmatrix}\n\\mathrm{TRUE}\\\\\n\\mathrm{FALSE}\\\\\n\\mathrm{TRUE}\\\\\n\\mathrm{TRUE}\\\\\n\\end{pmatrix}, \\qquad\n\\mathbf{\\mathrm{u^T}} =\n\\begin{pmatrix}\n1 & 1.5 & -14 & 7.233\\\\\n\\end{pmatrix}\n\\]\nMany functions lead to creation of a vector, among the most used are vector(mode = \"numeric\", length = 10), function c(), or using subset operators [ or [[.\nAn important rule is tied to vectors - value recycling.\n\n\nCode\nv <- c(1.4, 2.0, 6.1, 2.7)\nu <- c(2.0, 1.3)\n1u + v\n2u * v\n3u * 2.3\n\n\n\n1\n\nAdding two vectors while length of second is the multiple of the first\n\n2\n\nMultiplying two vectors while length of second is the multiple of the first\n\n3\n\nMultipling with single numeric value\n\n\n\n\n[1] 3.4 3.3 8.1 4.0\n[1] 2.80 2.60 12.20 3.51\n[1] 4.60 2.99\n\n\n\nWorking with vectors\n\n\nCode\n1x <- 1:10\nx <- seq(10:1)\nx <- vector(mode = \"numeric\", length = 10)\nx <- replicate(n = 10, expr = eval(2))\nx <- sample(x = 10, size = 10, replace = TRUE)\nx <- rep(x = 15, times = 2)\nx <- rnorm(n = 10, mean = 2, sd = 20)\n2t(x) * x\n3names(x) <- LETTERS[1:length(x)]\n4x[x > 0]\n5x[1:3]\n\n\n\n1\n\nVector creation \\(\\boldsymbol{\\mathrm{x}}\\) by different approaches. Sequences, repeats, repetitions and sampling\n\n2\n\nTransposition of vector.\n\n3\n\nNaming elements of a vector.\n\n4\n\nSelection of elements from a vector based on a condition.\n\n5\n\nSelection of elements from a vector based on an index.\n\n\n\n\n [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]\n[1,] 96.97616 834.4318 707.3374 1212.165 1288.363 16.33978 315.1559 608.6296\n [,9] [,10]\n[1,] 22.63338 199.5815\n D E F H I \n34.816167 35.893779 4.042249 24.670419 4.757455 \n A B C \n -9.847647 -28.886533 -26.595815 \n\n\n\n\nCode\n```{r}\n#| label: test-code-annotation\nV <- vector(mode = \"numeric\", length = 0) # empty numeric vector creation\nV[1] <- \"A\"\n```\n\n\n\n\n\nMatrices and arrays\nIf the object has more than one dimension, it is treated as an array. A special type of array is a matrix. Both object types have accompanying functions like colSums(), rowMeans().\n\nList of matrix bounded functions\n\n\nFunction\nMeaning\n\n\n\n\nnrow(), ncol()\nnumber of rows, columns in matrix\n\n\ndim()\ndtto\n\n\ndet()\nmatrix determinant\n\n\neigen()\neigenvalues, eigenvectors\n\n\ncolnames()\ncolumn names in matrix\n\n\nrowSums()\nrow sums in matrix\n\n\ncolMeans()\ncolumn means of matrix\n\n\nM[m, ]\nSelection of \\(m\\)-th row of matrix\n\n\nM[ ,n]\nSelection of \\(n\\)-th column of matrix\n\n\n\n\n\nCode\nx <- c(1:10)\n1dim(x) <- c(2, 5)\nx\n\n\n\n1\n\nConversion to \\(2\\times 2\\) dimension\n\n\n\n\n [,1] [,2] [,3] [,4] [,5]\n[1,] 1 3 5 7 9\n[2,] 2 4 6 8 10\n\n\n\n\nCode\nM <- matrix(data = 0, nrow = 5, ncol = 2) # empty matrix creation\nM[1, 1] <- 1 # add single value at origin\nM[, 1] <- 1.5 # store 1.5 to the whole first column\nM[c(1,3), 1:2] <- rnorm(2) # store random numbers to first two rows\n\ncolMeans(M) \n## [1] 1.4745562 0.5745562\nrowSums(M)\n## [1] 3.704401 1.500000 2.041160 1.500000 1.500000\n\n\nIt is possible to have matrices containing any data type, e.g.\n\\[\nM = \\left(\\begin{matrix}\n\\mathrm{A} & \\mathrm{B}\\\\\n\\mathrm{C} & \\mathrm{D}\n\\end{matrix}\\right),\\qquad\nN = \\left(\\begin{matrix}\n1+i & 5-3i\\\\\n10+2i & i\n\\end{matrix}\\right)\n\\]\n\n\nData frames\ndata.frame structure is the workhorse of elementary data processing. It is a possibly heterogenic table-like structure, allowing storage of multiple data types (even other structures) in different columns. A column in any data frame is called a variable and row represents a single observation. If the data suffice this single condition, we say they are in tidy format. Processing tidy data is a big topic withing the R community and curious reader is encouraged to follow the development in tidyverse package ecosystem.\n\n\nCode\nthaya <- data.frame(date = NA, \n runoff = NA, \n precipitation = NA) # new empty data.frame with variables 'date', 'runoff', 'precipitation' and 'temperature'\n#thaya$runoff <- rnorm(100, 1, 2)\n\n\n\n\nLists\nList is the most general basic data structure. It is possible to store vectors, matrices, data frames and also other lists within a list. List structure does not pose any limitations on the internal objects lengths.\n\n\nCode\nl <- list() # empty list creation \nl[\"A\"] <- 1\nprint(l)\n\n\n$A\n[1] 1\n\n\nCode\nl$A <- 2\nprint(l)\n\n\n$A\n[1] 2\n\n\n\n\nOther objects\nAlthough R is intended as functional programming language, more than one object oriented paradigm is implemented in the language. As new R users we encounter first OOP system in functions like summary and plot, which represent so called S3 generic functions. We will further work with S4 system when processing geospatial data using proxy libraries like sf and terra. The OOP is very complex and will not be further discussed within this text. For further study we recommend OOP sections in Advanced R by Hadley Wickham.\n\n\n\n2.3.6 Control flow\nCondition and cycles govern the run of the general flow of calculation, they are the building blocks of algorithms.\n\n2.3.6.1 Conditions\nA condition in code creates branching of computation. Placing a condition creates at least two options from which only one is to be satisfied. The condition is created either by if()/ifelse() or switch() construct. We can again call for a snippet from RStudio help resulting in\n\n\nCode\nif (condition) {\n ...\n}\n\nswitch (object,\n case = action\n)\n\nifelse(test, TRUE, FALSE)\n\n\n\nif()\n\n\nCode\nA <- 1\nif(A >= 1) {\n cat(\"A larger than or equal 1.\")\n}\n\n\nA larger than or equal 1.\n\n\n\n\nCode\nA <- 5\n1if(A >= 2) {\n cat(\"A is larger than or equal 2.\")\n} else if(A > 2) {\n cat(\"A is larger than 2.\")\n}\n\n\n\n1\n\nThe chain of conditions will close at the first evaluation which happens to be TRUE.\n\n\n\n\nA is larger than or equal 2.\n\n\n\n\nifelse()\nVectorized condition, in general looks like\n\n\nCode\nx <- -5:5\ncat(\"Element x + 3 is more than 0: \", ifelse(x - 3 > 0, yes = \"Yes\", no = \"No\"))\n\n\nElement x + 3 is more than 0: No No No No No No No No No Yes Yes\n\n\n\n\n\nswitch()\n\n\nCode\nvariant <- \"B\"\n2 * (switch(\n variant,\n1 \"A\" = 2,\n2 \"B\" = 3))\n\n\n\n1\n\n“A” variant did not happen,\n\n2\n\ninstead the “B” variant is truthful, so the expression is evaluated as \\(2\\cdot 3 = 6\\)\n\n\n\n\n[1] 6\n\n\n\n\n\n\n\n\nExercise\n\n\n\nCreate a following grading scheme:\n\n\n\nGrade\nResult\n\n\n\n\nA\n90 % - 100 %\n\n\nB\n75 % - 89 %\n\n\nC\n60 % - 74 %\n\n\nD\n< 60 %\n\n\n\n\n\n\n\n\n2.3.7 Loops\nLoops (cycles) provide use with the ability to execute single statement of a block of code in {} multiple times. There are three key words for loop construction. They differ in use cases.\n\nfor cycle\nProbably the most common loop is used when you know the number of iterations prior to calling. The iteration is therefore explicitly finite.\n\n\nCode\nfor (variable in vector) {\n ...\n}\n\n\nAn example\n\n\nCode\nfor(i in 1:4) cat(i, \". iteration\", \"\\n\", sep = \"\")\n\n\n1. iteration\n2. iteration\n3. iteration\n4. iteration\n\n\n\n\nwhile cycle\nwhile is used in when it is impossible to state how many times something should be repeated. The case is rather in the form while some condition is or is not met, repeat what is inside the body. It is also used in intentionally infinite loop e.g. operating systems.\n\n\nCode\ni <- 1\nwhile(i < 5) {\n cat(\"Iteration \", i, \"\\n\", sep = \"\")\n i <- i + 1\n}\n\n\nIteration 1\nIteration 2\nIteration 3\nIteration 4\n\n\n\n\nrepeat cycle\nIn the cases when we need the repetition at least once, we will evaluate the code inside until a condition is met.\n\n\nCode\ni <- 1\n1repeat {\n cat(\"Iteration\", i, \"\\n\")\n i <- i + 1\n2 if(i >= 5) break\n}\n\n\n\n1\n\nExecute in loop,\n\n2\n\nif a condition is met, break stops the cycle.\n\n\n\n\nIteration 1 \nIteration 2 \nIteration 3 \nIteration 4 \n\n\n\n\nbreak and next\nThere are two statements which controls the iteration flow. Anytime break is called, the rest of the body is skipped and the loop ends. Anytime next is called, the rest of the body is skipped and next iteration is started.\n\n\n\n\n\n\nExercise\n\n\n\n\nCreate a cycle, which for the numbers \\(x={1, 2, 3, 4, 5}\\) writes out \\(x^3\\).\nCalculates the cumulative sum for these.s\nCalculates the factorial number for the number x.\nWithe the help of readline() function (requests a number from the user), prints the number. If the given number is negative, the loop ends." + "text": "2.3 R as programming language\n\n2.3.1 Variables and name conventions\nIt is highly discouraged using spaces and diacritical marks in naming, like the Czech translation of the term “variable” - proměnná. Most programmers use either camelNotation or snake_notation for naming purposes. Obviously the R is case-sensitive so camelNotation and CamelNotation are two different things. Variables do not contain spaces, quotes, arithmetical, logical nor relational operators neither they contain special characters like =, -, ``. Objects cannot be named by key words.\n\nKey words\nif, else, repeat, while, function, for, in, next, repeat, break, TRUE, FALSE, NULL, Inf, NaN, NA, NA_integer_, NA_real_, NA_complex_, NA_character_\nIt is not recommended to inlude dot in the name, like morava.prutoky, and to match the names with commonly used functions. R is “case-sensitive” which means, that X does not equal x.\n\n\nExercise\nIntuitively, we might be guided to load the data into the data variable. This is the wrong however, since data() is a function to access datasets that are part of the basic R installation. Try it out.\n\n\nSome cases of possible but wrong naming\naaa, Morávka průtok [m/s], moje.proměnná\n\n\n\n\n2.3.2 Rules of quotation marks and parenthesses\nBoth represent the paired characters in R. Parenthesses are used in three versions: classical, square brackets and curly brackets (braces). All of them have specific non-overlaping usage.\n\n() are always to be found right next to a function name they delineate the space where function arguments are to be specified.\n\n[] are always use with the name of the object (vector, array, list, …) and signalize subselecting from the object.\n\n{} mark a block of code, which should be executed at once.\n\n\nQuotation marks introduce text strings. Both “double” and ‘single’ quotes can be used completely at will, they just need to be closed with the same type. Back quotes are also common and are used, for example, to delimit a non-standard column name in a structure.\n\n\n2.3.3 Functions\nYou can define own functions using the function() construct. If you work in ****RStudio, just type fun and tabulate a snippet from the IDE help. The action produces {(code-function-snippet?)}.\n\n\nCode\nname <- function(variables) {\n ...\n}\n\n\nname is the name of the function we would like to create and variables are the arguments of that function. Space between the {and } is called a body of a function and contains all the computation which is invoked when the function is called.\nLet’s put Here an example of creating own function to calculate weighted mean\n\\[\n\\bar{x} = \\dfrac{\\sum\\limits_{i=1}^{n} w_ix_i}{\\sum\\limits_{i=1}^{n}w_i},\n\\] where \\(x_iw_i\\) are the individual weighted measurements.\nWe define a simple function for that purpose and run an example.\n\n\nCode\nw_mean <- function(x, w = 1/length(x)) {\n sum(x*w)/sum(w)\n}\nw_mean(1:10)\n\n\n[1] 55\n\n\nHere is a different example:\n\n\nCode\nx <- rnorm(100)\n1nejblizsi_hodnota <- function(x, value) {\n x[which(abs(x - value) == min(abs(x - value)))]\n}\n\ncat(\"Hodnota nejblíže 0 z vektoru x je:\" , nejblizsi_hodnota(x = x, value = 0))\n\n\n\n1\n\nExample of function, which seeks the neares number from a vector x to a certain referential value.\n\n\n\n\nHodnota nejblíže 0 z vektoru x je: -0.01590373\n\n\nWe can test if we get the same result as the primitive function from R using all.equal() statement.\n\n\nCode\nall.equal(w_mean(x = 1:5, w = c(0.25, 0.25, 1, 2, 3)), \n weighted.mean(x = 1:5, w = c(0.25, 0.25, 1, 2, 3)))\n\n\n[1] TRUE\n\n\nAny argument without default value in the function definition has to be provided on function call. You can frequently see functions with the possibility to specify ... a so-called three dot construct or ellipsis. The ellipsis allows for adding any number of arguments to a function call, after all the named ones.\n\n\n2.3.4 Data types\nThe basic types are logical, integer, numeric, complex, character and raw. There are some additional types which we will encounter like Date. Since R is dynamically typed, it is not necessary for the user to declare variables before using them. Also the type changes without notice based on the stored values, where the chain goes from the least complex to the most. The summary is in the following table\n\n\nCode\nTRUE # logical, also T as short version\n## [1] TRUE\n1L # integer\n## [1] 1\n1.2 # numeric\n## [1] 1.2\n1+3i # complex\n## [1] 1+3i\n\"A\" # character, also 'A'\n## [1] \"A\"\n\n\nThey represent the individual elements of data structures. R dynamically typed and does not require declarations before usage.\n\nBasic types and coercions.\n\n\n\n\n\n\n\n\n\n\n\nlogical\ninteger\nnumeric\ncomplex\ncharacter\n\n\n\n\nlogical\nlogical\ninteger\nnumeric\ncomplex\ncharacter\n\n\ninteger\nlogical\ninteger\nnumeric\ncomplex\ncharacter\n\n\nnumeric\nlogical\nnumeric\nnumeric\ncomplex\ncharacter\n\n\ncomplex\nlogical\ninteger + warning\nnumeric + warning\ncomplex\ncharacter\n\n\ncharacter\nNA_logical\nNA_integer + warning\nNA_numeric + warning\nNA_complex + warning\ncharacter\n\n\n\nTwo types of functions are connected to data types: is.___ a as.___. Is is either questioning or coertion of data type. Try also class(), mode().\n\n\nCode\nis.character(\"ABC\")\n\n\n[1] TRUE\n\n\nCode\nas.integer(11 + 1i)\n\n\nWarning: imaginary parts discarded in coercion\n\n\n[1] 11\n\n\n\n\n\n\n\n\nExercise\n\n\n\n\nCreate in any way a vector x of 10 different numerical values, where \\(x\\in\\mathbb{R}\\).\nWrite an expression to select numbers between -5 and 5 from this vector.\nConvert to integer type and discuss the result.\nAdd 3 positions “A”, “B” and “C” to the vector, has the vector changed?\n\n\n\n\n\n2.3.5 Data structures\n\nVectors\nAtomic vectors are single-type linear structures. They can contain elements of any type, from logical, integer, numeric, complex, character. A vector is a basic building structure in the R language, there is nothing like a scalar quantity here. The concept of vector is understood here in the mathematical sense as a vector of values representing a point in \\(n\\)-dimensional space.\n\\[\n\\mathbf{\\mathrm{u}} =\n\\begin{pmatrix}\n1\\\\\n1.5\\\\\n-14\\\\\n7.223\\\\\n\\end{pmatrix}, \\qquad\n\\mathbf{\\mathrm{v}} =\n\\begin{pmatrix}\n\\mathrm{TRUE}\\\\\n\\mathrm{FALSE}\\\\\n\\mathrm{TRUE}\\\\\n\\mathrm{TRUE}\\\\\n\\end{pmatrix}, \\qquad\n\\mathbf{\\mathrm{u^T}} =\n\\begin{pmatrix}\n1 & 1.5 & -14 & 7.233\\\\\n\\end{pmatrix}\n\\]\nMany functions lead to creation of a vector, among the most used are vector(mode = \"numeric\", length = 10), function c(), or using subset operators [ or [[.\nAn important rule is tied to vectors - value recycling.\n\n\nCode\nv <- c(1.4, 2.0, 6.1, 2.7)\nu <- c(2.0, 1.3)\n1u + v\n2u * v\n3u * 2.3\n\n\n\n1\n\nAdding two vectors while length of second is the multiple of the first\n\n2\n\nMultiplying two vectors while length of second is the multiple of the first\n\n3\n\nMultipling with single numeric value\n\n\n\n\n[1] 3.4 3.3 8.1 4.0\n[1] 2.80 2.60 12.20 3.51\n[1] 4.60 2.99\n\n\n\nWorking with vectors\n\n\nCode\n1x <- 1:10\nx <- seq(10:1)\nx <- vector(mode = \"numeric\", length = 10)\nx <- replicate(n = 10, expr = eval(2))\nx <- sample(x = 10, size = 10, replace = TRUE)\nx <- rep(x = 15, times = 2)\nx <- rnorm(n = 10, mean = 2, sd = 20)\n2t(x) * x\n3names(x) <- LETTERS[1:length(x)]\n4x[x > 0]\n5x[1:3]\n\n\n\n1\n\nVector creation \\(\\boldsymbol{\\mathrm{x}}\\) by different approaches. Sequences, repeats, repetitions and sampling\n\n2\n\nTransposition of vector.\n\n3\n\nNaming elements of a vector.\n\n4\n\nSelection of elements from a vector based on a condition.\n\n5\n\nSelection of elements from a vector based on an index.\n\n\n\n\n [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]\n[1,] 110.3749 5.84625 693.2721 147.1503 9.649926 1766.76 7.561956 1.109624\n [,9] [,10]\n[1,] 148.2652 0.350399\n A B E F G I J \n10.5059478 2.4179021 3.1064330 42.0328426 2.7499010 12.1764216 0.5919451 \n A B C \n 10.505948 2.417902 -26.330061 \n\n\n\n\nCode\n```{r}\n#| label: test-code-annotation\nV <- vector(mode = \"numeric\", length = 0) # empty numeric vector creation\nV[1] <- \"A\"\n```\n\n\n\n\n\nMatrices and arrays\nIf the object has more than one dimension, it is treated as an array. A special type of array is a matrix. Both object types have accompanying functions like colSums(), rowMeans().\n\nList of matrix bounded functions\n\n\nFunction\nMeaning\n\n\n\n\nnrow(), ncol()\nnumber of rows, columns in matrix\n\n\ndim()\ndtto\n\n\ndet()\nmatrix determinant\n\n\neigen()\neigenvalues, eigenvectors\n\n\ncolnames()\ncolumn names in matrix\n\n\nrowSums()\nrow sums in matrix\n\n\ncolMeans()\ncolumn means of matrix\n\n\nM[m, ]\nSelection of \\(m\\)-th row of matrix\n\n\nM[ ,n]\nSelection of \\(n\\)-th column of matrix\n\n\n\n\n\nCode\nx <- c(1:10)\n1dim(x) <- c(2, 5)\nx\n\n\n\n1\n\nConversion to \\(2\\times 2\\) dimension\n\n\n\n\n [,1] [,2] [,3] [,4] [,5]\n[1,] 1 3 5 7 9\n[2,] 2 4 6 8 10\n\n\n\n\nCode\nM <- matrix(data = 0, nrow = 5, ncol = 2) # empty matrix creation\nM[1, 1] <- 1 # add single value at origin\nM[, 1] <- 1.5 # store 1.5 to the whole first column\nM[c(1,3), 1:2] <- rnorm(2) # store random numbers to first two rows\n\ncolMeans(M) \n## [1] 0.88685608 -0.01314392\nrowSums(M)\n## [1] -1.837653 1.500000 1.706214 1.500000 1.500000\n\n\nIt is possible to have matrices containing any data type, e.g.\n\\[\nM = \\left(\\begin{matrix}\n\\mathrm{A} & \\mathrm{B}\\\\\n\\mathrm{C} & \\mathrm{D}\n\\end{matrix}\\right),\\qquad\nN = \\left(\\begin{matrix}\n1+i & 5-3i\\\\\n10+2i & i\n\\end{matrix}\\right)\n\\]\n\n\nData frames\ndata.frame structure is the workhorse of elementary data processing. It is a possibly heterogenic table-like structure, allowing storage of multiple data types (even other structures) in different columns. A column in any data frame is called a variable and row represents a single observation. If the data suffice this single condition, we say they are in tidy format. Processing tidy data is a big topic withing the R community and curious reader is encouraged to follow the development in tidyverse package ecosystem.\n\n\nCode\nthaya <- data.frame(date = NA, \n runoff = NA, \n precipitation = NA) # new empty data.frame with variables 'date', 'runoff', 'precipitation' and 'temperature'\n#thaya$runoff <- rnorm(100, 1, 2)\n\n\n\n\nLists\nList is the most general basic data structure. It is possible to store vectors, matrices, data frames and also other lists within a list. List structure does not pose any limitations on the internal objects lengths.\n\n\nCode\nl <- list() # empty list creation \nl[\"A\"] <- 1\nprint(l)\n\n\n$A\n[1] 1\n\n\nCode\nl$A <- 2\nprint(l)\n\n\n$A\n[1] 2\n\n\n\n\nOther objects\nAlthough R is intended as functional programming language, more than one object oriented paradigm is implemented in the language. As new R users we encounter first OOP system in functions like summary and plot, which represent so called S3 generic functions. We will further work with S4 system when processing geospatial data using proxy libraries like sf and terra. The OOP is very complex and will not be further discussed within this text. For further study we recommend OOP sections in Advanced R by Hadley Wickham.\n\n\n\n2.3.6 Control flow\nCondition and cycles govern the run of the general flow of calculation, they are the building blocks of algorithms.\n\n2.3.6.1 Conditions\nA condition in code creates branching of computation. Placing a condition creates at least two options from which only one is to be satisfied. The condition is created either by if()/ifelse() or switch() construct. We can again call for a snippet from RStudio help resulting in\n\n\nCode\nif (condition) {\n ...\n}\n\nswitch (object,\n case = action\n)\n\nifelse(test, TRUE, FALSE)\n\n\n\nif()\n\n\nCode\nA <- 1\nif(A >= 1) {\n cat(\"A larger than or equal 1.\")\n}\n\n\nA larger than or equal 1.\n\n\n\n\nCode\nA <- 5\n1if(A >= 2) {\n cat(\"A is larger than or equal 2.\")\n} else if(A > 2) {\n cat(\"A is larger than 2.\")\n}\n\n\n\n1\n\nThe chain of conditions will close at the first evaluation which happens to be TRUE.\n\n\n\n\nA is larger than or equal 2.\n\n\n\n\nifelse()\nVectorized condition, in general looks like\n\n\nCode\nx <- -5:5\ncat(\"Element x + 3 is more than 0: \", ifelse(x - 3 > 0, yes = \"Yes\", no = \"No\"))\n\n\nElement x + 3 is more than 0: No No No No No No No No No Yes Yes\n\n\n\n\n\nswitch()\n\n\nCode\nvariant <- \"B\"\n2 * (switch(\n variant,\n1 \"A\" = 2,\n2 \"B\" = 3))\n\n\n\n1\n\n“A” variant did not happen,\n\n2\n\ninstead the “B” variant is truthful, so the expression is evaluated as \\(2\\cdot 3 = 6\\)\n\n\n\n\n[1] 6\n\n\n\n\n\n\n\n\nExercise\n\n\n\nCreate a following grading scheme:\n\n\n\nGrade\nResult\n\n\n\n\nA\n90 % - 100 %\n\n\nB\n75 % - 89 %\n\n\nC\n60 % - 74 %\n\n\nD\n< 60 %\n\n\n\n\n\n\n\n\n2.3.7 Loops\nLoops (cycles) provide use with the ability to execute single statement of a block of code in {} multiple times. There are three key words for loop construction. They differ in use cases.\n\nfor cycle\nProbably the most common loop is used when you know the number of iterations prior to calling. The iteration is therefore explicitly finite.\n\n\nCode\nfor (variable in vector) {\n ...\n}\n\n\nAn example\n\n\nCode\nfor(i in 1:4) cat(i, \". iteration\", \"\\n\", sep = \"\")\n\n\n1. iteration\n2. iteration\n3. iteration\n4. iteration\n\n\n\n\nwhile cycle\nwhile is used in when it is impossible to state how many times something should be repeated. The case is rather in the form while some condition is or is not met, repeat what is inside the body. It is also used in intentionally infinite loop e.g. operating systems.\n\n\nCode\ni <- 1\nwhile(i < 5) {\n cat(\"Iteration \", i, \"\\n\", sep = \"\")\n i <- i + 1\n}\n\n\nIteration 1\nIteration 2\nIteration 3\nIteration 4\n\n\n\n\nrepeat cycle\nIn the cases when we need the repetition at least once, we will evaluate the code inside until a condition is met.\n\n\nCode\ni <- 1\n1repeat {\n cat(\"Iteration\", i, \"\\n\")\n i <- i + 1\n2 if(i >= 5) break\n}\n\n\n\n1\n\nExecute in loop,\n\n2\n\nif a condition is met, break stops the cycle.\n\n\n\n\nIteration 1 \nIteration 2 \nIteration 3 \nIteration 4 \n\n\n\n\nbreak and next\nThere are two statements which controls the iteration flow. Anytime break is called, the rest of the body is skipped and the loop ends. Anytime next is called, the rest of the body is skipped and next iteration is started.\n\n\n\n\n\n\nExercise\n\n\n\n\nCreate a cycle, which for the numbers \\(x={1, 2, 3, 4, 5}\\) writes out \\(x^3\\).\nCalculates the cumulative sum for these.s\nCalculates the factorial number for the number x.\nWithe the help of readline() function (requests a number from the user), prints the number. If the given number is negative, the loop ends." }, { "objectID": "02_statistics.html#exploratory-data-analysis-eda", @@ -116,13 +116,13 @@ "href": "04_interpolation.html#gstat", "title": "5  Data interpolation", "section": "5.2 gstat", - "text": "5.2 gstat\nThere are many libraries listed in CRAN geostatistics task view. One of these is called gstat, it was developed and is maintained by Edzer Pebesma, who is also behind the raster and terra packages. The gstat package contains functions no olny for interpolations.\n\n\nCode\nlibrary(gstat)\n\n\nWarning: package 'gstat' was built under R version 4.4.1\n\n\nCode\nidw_res <- gstat::idw(formula = value ~ 1, \n locations = dom, \n newdata = grid)\n\n\n[inverse distance weighted interpolation]\n\n\nCode\nidw_res <- st_as_sf(idw_res)\nplot(idw_res |> \n dplyr::select(var1.pred), \n breaks = seq(min(idw_res$var1.pred), \n max(idw_res$var1.pred), \n length.out = 25),\n lwd = 0.001,\n pal = scico(24, \n palette = \"davos\",\n end = 0.9, \n direction = -1),\n main = \"Precipitation [mm]\", \n #pch = 20, # Point character selection\n graticule = TRUE, # Display graticules\n axes = TRUE, # Display plot axes\n bgc = \"#f0f0f033\", # Background color\n key.pos = 1, \n reset = FALSE)\n\n\n\n\n\n\n\nCode\npower <- 2 # You can adjust the power parameter\nweighted_sum <- apply(distances, 1, function(d) sum(dom$value / (d^power)))\nweighted_sum" + "text": "5.2 gstat\nThere are many libraries listed in CRAN geostatistics task view. One of these is called gstat, it was developed and is maintained by Edzer Pebesma, who is also behind the raster and terra packages. The gstat package contains functions no olny for interpolations.\n\n\nCode\nlibrary(gstat)\n\n\nWarning: package 'gstat' was built under R version 4.4.1\n\n\nCode\nidw_res <- gstat::idw(formula = value ~ 1, \n locations = dom, \n newdata = grid)\n\n\n[inverse distance weighted interpolation]\n\n\nCode\nidw_res <- st_as_sf(idw_res)\nplot(idw_res |> \n dplyr::select(var1.pred), \n breaks = seq(min(idw_res$var1.pred), \n max(idw_res$var1.pred), \n length.out = 25),\n lwd = 0.001,\n pal = scico(24, \n palette = \"davos\",\n end = 0.9, \n direction = -1),\n main = \"Precipitation [mm]\", \n #pch = 20, # Point character selection\n graticule = TRUE, # Display graticules\n axes = TRUE, # Display plot axes\n bgc = \"#f0f0f033\", # Background color\n key.pos = 1, \n reset = FALSE)\n\n\n\n\n\n\n\n\n\n\n\nCode\npower <- 2 # You can adjust the power parameter\nweighted_sum <- apply(distances, 1, function(d) sum(dom$value / (d^power)))\nweighted_sum" }, { "objectID": "04_interpolation.html#krigging", "href": "04_interpolation.html#krigging", "title": "5  Data interpolation", "section": "5.3 Krigging", - "text": "5.3 Krigging\nAnother interpolation technique is called Krigging. Opposing to the Inverse Distance Weighted method.\n\n\nCode\nprojected_crs <- 32633 # Replace with the appropriate UTM zone for your data\n\ndom_projected <- st_transform(dom, crs = projected_crs)\ngrid_projected <- st_transform(grid, crs = projected_crs)\n\nset.seed(123) # For reproducibility\nidw_points <- st_centroid(idw_res)\n\n\nWarning: st_centroid assumes attributes are constant over geometries\n\n\nCode\nsampled_points <- idw_points[sample(1:nrow(idw_points), 50), ]\n\ncombined_points <- rbind(\n dom,\n sampled_points |> \n dplyr::select(value = var1.pred, geometry)\n)\ncombined_points <- st_transform(combined_points, crs = projected_crs)\n\nvariogram <- vgm(psill = 0.05, model = \"Mat\", range = 10000, nugget = 0.15)\n\nkrig_res <- gstat::krige(\n formula = value ~ 1,\n locations = combined_points,\n newdata = grid_projected,\n model = variogram # Use the appropriate fitted variogram model\n)\n\n\n[using ordinary kriging]\n\n\nCode\n# Step 3: Reproject the kriged result back to the original CRS (WGS84)\nkrig_res <- st_transform(st_as_sf(krig_res), crs = 4326)\n# Generate unique breaks\nmin_val <- min(krig_res$var1.pred, na.rm = TRUE)\nmax_val <- max(krig_res$var1.pred, na.rm = TRUE)\n\n# Ensure that min and max are sufficiently different to create unique breaks\nif (max_val - min_val > 0) {\n breaks <- seq(min_val, max_val, length.out = 25)\n} else {\n breaks <- unique(c(min_val, max_val)) # Fallback for nearly constant data\n}\n\n# Use the scico color palette with the correct number of colors\ncolors <- scico(length(breaks) - 1, \n palette = \"davos\", \n end = 0.9, \n direction = -1)\n\n# Plotting using the 'pal' argument for sf objects\nplot(\n krig_res |> dplyr::select(var1.pred), \n breaks = breaks,\n pal = colors, # Use 'pal' to specify the color palette\n lwd = 0.001,\n main = \"Precipitation [mm]\", \n graticule = TRUE, \n axes = TRUE, \n bgc = \"#f0f0f033\", \n key.pos = 1, \n reset = FALSE\n)" + "text": "5.3 Krigging\nAnother interpolation technique is called Krigging. Opposing to the Inverse Distance Weighted method.\n\n\nCode\nprojected_crs <- 32633 # Replace with the appropriate UTM zone for your data\n\ndom_projected <- st_transform(dom, crs = projected_crs)\ngrid_projected <- st_transform(grid, crs = projected_crs)\n\nset.seed(123) # For reproducibility\nidw_points <- st_centroid(idw_res)\n\n\nWarning: st_centroid assumes attributes are constant over geometries\n\n\nCode\nsampled_points <- idw_points[sample(1:nrow(idw_points), 50), ]\n\ncombined_points <- rbind(\n dom,\n sampled_points |> \n dplyr::select(value = var1.pred, geometry)\n)\ncombined_points <- st_transform(combined_points, crs = projected_crs)\n\nvariogram <- vgm(psill = 0.05, model = \"Mat\", range = 300000, nugget = 0.15)\n\nkrig_res <- gstat::krige(\n formula = value ~ 1,\n locations = combined_points,\n newdata = grid_projected,\n model = variogram # Use the appropriate fitted variogram model\n)\n\n\n[using ordinary kriging]\n\n\nCode\n# Step 3: Reproject the kriged result back to the original CRS (WGS84)\nkrig_res <- st_transform(st_as_sf(krig_res), crs = 4326)\n# Generate unique breaks\nmin_val <- min(krig_res$var1.pred, na.rm = TRUE)\nmax_val <- max(krig_res$var1.pred, na.rm = TRUE)\n\n# Ensure that min and max are sufficiently different to create unique breaks\nif (max_val - min_val > 0) {\n breaks <- seq(min_val, max_val, length.out = 25)\n} else {\n breaks <- unique(c(min_val, max_val)) # Fallback for nearly constant data\n}\n\n# Use the scico color palette with the correct number of colors\ncolors <- scico(length(breaks) - 1, \n palette = \"davos\", \n end = 0.9, \n direction = -1)\n\n# Plotting using the 'pal' argument for sf objects\nplot(\n krig_res |> dplyr::select(var1.pred), \n breaks = breaks,\n pal = colors, # Use 'pal' to specify the color palette\n lwd = 0.001,\n main = \"Precipitation [mm]\", \n graticule = TRUE, \n axes = TRUE, \n bgc = \"#f0f0f033\", \n key.pos = 1, \n reset = FALSE\n)" } ] \ No newline at end of file