diff --git a/learn-r-2ed-crc.pdf b/Aphalo-CR-9781032518435-Learn-R-2024-03-05.pdf similarity index 99% rename from learn-r-2ed-crc.pdf rename to Aphalo-CR-9781032518435-Learn-R-2024-03-05.pdf index 34064725..f1d7759b 100644 Binary files a/learn-r-2ed-crc.pdf and b/Aphalo-CR-9781032518435-Learn-R-2024-03-05.pdf differ diff --git a/CRC-2nd-ed/proofs/9781032518435_voucher_proofs_PE.pdf b/CRC-2nd-ed/proofs/9781032518435_voucher_proofs_PE.pdf new file mode 100644 index 00000000..94271a37 Binary files /dev/null and b/CRC-2nd-ed/proofs/9781032518435_voucher_proofs_PE.pdf differ diff --git a/appendixes.prj b/appendixes.prj index 8f6c1509..6302ea31 100644 --- a/appendixes.prj +++ b/appendixes.prj @@ -13,10 +13,10 @@ TeX:RNW:UTF-8 2 0 189 20 189 25 6074 -1 6522 208 1 1 458 435 1 906 254 255 -1 0 0 33 1 0 25 189 0 -1 0 learn-r-2ed-crc.tex TeX -403713275 0 -1 777601 -1 777604 152 152 1581 1098 1 1 1186 667 -1 -1 0 0 49 -1 -1 49 1 0 777604 -1 0 -1 0 +403713275 2 -1 1125279 -1 1125282 152 152 1581 1098 1 1 484 2175 -1 -1 0 0 49 -1 -1 49 1 0 1125282 -1 0 -1 0 R.plotting.Rnw TeX:RNW:UNIX -17936379 0 -1 3770 -1 3775 380 380 1366 1438 1 1 445 957 -1 -1 0 0 115133 -1 -1 115133 1 0 3775 -1 0 -1 0 +17936379 2 -1 107594 -1 107597 380 380 1366 1438 1 1 354 667 -1 -1 0 0 115133 -1 -1 115133 1 0 107597 -1 0 -1 0 R.intro.Rnw TeX:RNW 17837307 1 -1 15642 -1 15662 228 228 1358 1175 1 1 1407 1218 -1 -1 0 0 30 -1 -1 30 1 0 15662 -1 0 -1 0 @@ -25,7 +25,7 @@ BibTeX:UNIX 1147890 2 334 51 334 38 38 38 1429 959 1 1 627 667 -1 -1 0 0 1 1 1 1 1 0 38 334 0 -1 0 preface.Rnw TeX:RNW -17838075 0 -1 8608 -1 8608 266 266 1252 1324 1 1 1121 1363 -1 -1 0 0 18 -1 -1 18 1 0 8608 -1 0 -1 0 +17838075 0 -1 7169 -1 8523 266 266 1252 1324 1 1 1277 841 -1 -1 0 0 18 -1 -1 18 1 0 8523 -1 0 -1 0 R.data.containers.Rnw TeX:RNW:UNIX 17936379 0 -1 41150 -1 41147 190 190 1324 1242 1 1 601 667 -1 -1 0 0 83326 -1 -1 83326 3 0 41147 -1 1 0 -1 2 0 -1 0 -1 0 diff --git a/appendixes.prj.bak b/appendixes.prj.bak index 7f89936f..4864bc71 100644 --- a/appendixes.prj.bak +++ b/appendixes.prj.bak @@ -13,10 +13,10 @@ TeX:RNW:UTF-8 2 0 189 20 189 25 6074 -1 6522 208 1 1 458 435 1 906 254 255 -1 0 0 33 1 0 25 189 0 -1 0 learn-r-2ed-crc.tex TeX -403713275 0 -1 777601 -1 777604 152 152 1581 1098 1 1 1186 -1508 -1 -1 0 0 49 -1 -1 49 1 0 777604 -1 0 -1 0 +403713275 2 -1 1125279 -1 1125282 152 152 1581 1098 1 1 484 435 -1 -1 0 0 49 -1 -1 49 1 0 1125282 -1 0 -1 0 R.plotting.Rnw TeX:RNW:UNIX -17936379 0 -1 3770 -1 3775 380 380 1366 1438 1 1 445 957 -1 -1 0 0 115133 -1 -1 115133 1 0 3775 -1 0 -1 0 +17936379 2 -1 107594 -1 107597 380 380 1366 1438 1 1 354 667 -1 -1 0 0 115133 -1 -1 115133 1 0 107597 -1 0 -1 0 R.intro.Rnw TeX:RNW 17837307 1 -1 15642 -1 15662 228 228 1358 1175 1 1 1407 1218 -1 -1 0 0 30 -1 -1 30 1 0 15662 -1 0 -1 0 @@ -25,7 +25,7 @@ BibTeX:UNIX 1147890 2 334 51 334 38 38 38 1429 959 1 1 627 667 -1 -1 0 0 1 1 1 1 1 0 38 334 0 -1 0 preface.Rnw TeX:RNW -17838075 0 -1 8608 -1 8608 266 266 1252 1324 1 1 1121 1363 -1 -1 0 0 18 -1 -1 18 1 0 8608 -1 0 -1 0 +17838075 0 -1 7169 -1 8523 266 266 1252 1324 1 1 1277 841 -1 -1 0 0 18 -1 -1 18 1 0 8523 -1 0 -1 0 R.data.containers.Rnw TeX:RNW:UNIX 17936379 0 -1 41150 -1 41147 190 190 1324 1242 1 1 601 667 -1 -1 0 0 83326 -1 -1 83326 3 0 41147 -1 1 0 -1 2 0 -1 0 -1 0 diff --git a/learn-r-2ed-crc.synctex b/learn-r-2ed-crc.synctex index 7e836b0e..77ff843d 100644 --- a/learn-r-2ed-crc.synctex +++ b/learn-r-2ed-crc.synctex @@ -1445,11 +1445,11 @@ g195,13:7613813,24322441 (195,13:7613813,24322441:2097150,481690,0 k195,13:9710963,24322441:1126562 ) -g195,13:12626659,24322441 -g195,13:15545632,24322441 -g195,13:16396289,24322441 -g195,13:19557090,24322441 -g195,13:19557090,24322441 +g195,13:12296358,24322441 +g195,13:15215331,24322441 +g195,13:16065988,24322441 +g195,13:19226789,24322441 +g195,13:19226789,24322441 (195,13:19666601,24322441:501378,78643,0 $195,13:19666601,24322441 (195,13:19830455,24322441:173670,78643,0 @@ -37166,7 +37166,7 @@ g1,162:9545814,29532609 g1,162:10347974,29532609 g1,162:11532864,29532609 g1,162:13858081,29532609 -k1,162:32583029,29532609:16542599 +k1,162:32583029,29532609:16507865 g1,162:32583029,29532609 ) (1,163:6630773,30790905:25952256,513147,126483 @@ -37187,104 +37187,104 @@ k1,162:29591310,30790905:194408 k1,162:32583029,30790905:0 ) (1,163:6630773,31655985:25952256,513147,134348 -k1,162:7579079,31655985:265421 -k1,162:11907077,31655985:265421 -k1,162:14310281,31655985:265420 -k1,162:15227130,31655985:265421 -k1,162:16633533,31655985:265421 -k1,162:18279798,31655985:265421 -k1,162:20837667,31655985:265420 -k1,162:23344419,31655985:265421 -k1,162:25846584,31655985:265421 -k1,162:28450330,31655985:265421 -k1,162:31286727,31655985:265420 -k1,162:32168186,31655985:265421 -k1,163:32583029,31655985:0 +k1,162:7467016,31655985:153358 +k1,162:11682950,31655985:153357 +k1,162:13974092,31655985:153358 +k1,162:14778878,31655985:153358 +k1,162:16073217,31655985:153357 +k1,162:17607419,31655985:153358 +k1,162:20053226,31655985:153358 +k1,162:22447914,31655985:153357 +k1,162:24838016,31655985:153358 +k1,162:27329699,31655985:153358 +k1,162:30054033,31655985:153357 +k1,162:30823429,31655985:153358 +k1,162:31391584,31655985:153312 +k1,162:32583029,31655985:0 ) (1,163:6630773,32521065:25952256,513147,134348 -k1,162:8072846,32521065:250628 -k1,162:9342560,32521065:250629 -k1,162:13322842,32521065:250628 -k1,162:16483924,32521065:250628 -k1,162:18247778,32521065:250628 -k1,162:19114445,32521065:250629 -k1,162:20384158,32521065:250628 -k1,162:22390496,32521065:250628 -k1,162:24096024,32521065:250629 -k1,162:25819246,32521065:250628 -k1,162:26729166,32521065:250628 -k1,162:27998879,32521065:250628 -k1,162:29745695,32521065:250629 -k1,162:31563944,32521065:250628 +k1,162:7892294,32521065:242436 +k1,162:11864385,32521065:242437 +k1,162:15017275,32521065:242436 +k1,162:16772937,32521065:242436 +k1,162:17631411,32521065:242436 +k1,162:18892933,32521065:242437 +k1,162:20891079,32521065:242436 +k1,162:22588414,32521065:242436 +k1,162:24303445,32521065:242437 +k1,162:25205173,32521065:242436 +k1,162:26466694,32521065:242436 +k1,162:28205317,32521065:242436 +k1,162:30015375,32521065:242437 +k1,162:31276896,32521065:242436 k1,162:32583029,32521065:0 ) (1,163:6630773,33386145:25952256,513147,134348 -k1,162:8218353,33386145:281447 -k1,162:10736544,33386145:281447 -k1,162:12209436,33386145:281447 -k1,162:15082177,33386145:281447 -k1,162:17950330,33386145:281447 -k1,162:19303946,33386145:281447 -k1,162:23697122,33386145:281447 -k1,162:25973485,33386145:281447 -k1,162:27539438,33386145:281447 -k1,162:28176745,33386145:281447 -k1,162:29591310,33386145:281447 +k1,162:9004189,33386145:136672 +k1,162:10332306,33386145:136672 +k1,162:13060272,33386145:136672 +k1,162:15783650,33386145:136672 +k1,162:16992491,33386145:136672 +k1,162:21240893,33386145:136673 +k1,162:23372481,33386145:136672 +k1,162:24793659,33386145:136672 +k1,162:25286191,33386145:136672 +k1,162:26555981,33386145:136672 +k1,162:29684372,33386145:136672 k1,162:32583029,33386145:0 ) (1,163:6630773,34251225:25952256,513147,134348 -k1,162:9736871,34251225:207441 -k1,162:12979940,34251225:207441 -k1,162:13870265,34251225:207440 -k1,162:17152000,34251225:207441 -k1,162:18550886,34251225:207441 -k1,162:19890789,34251225:207441 -k1,162:23363889,34251225:207441 -k1,162:24771949,34251225:207440 -k1,162:27124383,34251225:207441 -$1,162:27331477,34251225 -$1,162:27852488,34251225 -k1,162:29918990,34251225:207441 +k1,162:9867722,34251225:201321 +k1,162:10751928,34251225:201321 +k1,162:14027543,34251225:201321 +k1,162:15420309,34251225:201321 +k1,162:16754092,34251225:201321 +k1,162:20221073,34251225:201322 +k1,162:21623014,34251225:201321 +k1,162:23969328,34251225:201321 +$1,162:24176422,34251225 +$1,162:24697433,34251225 +k1,162:26757815,34251225:201321 +k1,162:29623175,34251225:201321 +k1,162:30491652,34251225:201321 +k1,162:31107814,34251225:201319 k1,162:32583029,34251225:0 ) (1,163:6630773,35116305:25952256,513147,134348 -k1,162:7459985,35116305:162056 -k1,162:8036847,35116305:162019 -k1,162:9674118,35116305:162056 -k1,162:13149674,35116305:162056 -k1,162:17909736,35116305:162056 -k1,162:21052368,35116305:162055 -k1,162:22233509,35116305:162056 -k1,162:23678760,35116305:162056 -k1,162:25230835,35116305:162056 -k1,162:28139505,35116305:162056 -k1,162:31391584,35116305:162056 +k1,162:10147959,35116305:203686 +k1,162:15123321,35116305:203686 +k1,162:18307583,35116305:203685 +k1,162:19530354,35116305:203686 +k1,162:21017235,35116305:203686 +k1,162:22610940,35116305:203686 +k1,162:25561240,35116305:203686 +k1,162:28854948,35116305:203685 +k1,162:30250079,35116305:203686 +k1,162:31966991,35116305:203686 k1,162:32583029,35116305:0 ) (1,163:6630773,35981385:25952256,513147,134348 -k1,162:8301395,35981385:157396 -k1,162:9074828,35981385:157395 -k1,162:10435465,35981385:157396 -k1,162:12834192,35981385:157396 -k1,162:15402001,35981385:157395 -k1,162:18424631,35981385:157396 -k1,162:20057242,35981385:157396 -k1,162:21500453,35981385:157395 -k1,162:24087269,35981385:157396 -k1,162:27233107,35981385:157396 -k1,162:28673697,35981385:157395 -k1,162:31436804,35981385:157396 +k1,162:8019972,35981385:185958 +k1,162:10447262,35981385:185959 +k1,162:13043634,35981385:185958 +k1,162:16094827,35981385:185959 +k1,162:17756000,35981385:185958 +k1,162:19227774,35981385:185958 +k1,162:22016823,35981385:185959 +k1,162:25191223,35981385:185958 +k1,162:26660377,35981385:185959 +k1,162:29452046,35981385:185958 +k1,162:30784230,35981385:185959 +k1,162:31326048,35981385:185958 k1,162:32583029,35981385:0 ) (1,163:6630773,36846465:25952256,513147,134348 -g1,162:7185862,36846465 -g1,162:8668286,36846465 -g1,162:11852025,36846465 -g1,162:12702682,36846465 -g1,162:15369342,36846465 -g1,162:17176169,36846465 -g1,162:17991436,36846465 -k1,163:32583029,36846465:11710632 +g1,162:9814512,36846465 +g1,162:10665169,36846465 +g1,162:13331829,36846465 +g1,162:15138656,36846465 +g1,162:15953923,36846465 +k1,163:32583029,36846465:13748145 g1,163:32583029,36846465 ) (1,165:6630773,37711545:25952256,505283,134348 @@ -37462,7 +37462,7 @@ g1,165:-473656,-710413 ] ) ] -!23913 +!23933 }14 !11 {15 @@ -37764,21 +37764,20 @@ k1,168:31015408,15769977:214403 k1,168:32583029,15769977:0 ) (1,169:6630773,16635057:25952256,513147,134348 -k1,168:8367084,16635057:141820 -k1,168:9160331,16635057:141819 -k1,168:11460252,16635057:141820 -k1,168:12498605,16635057:141820 -k1,168:14011438,16635057:141820 -k1,168:15531479,16635057:141819 -k1,168:17728508,16635057:141820 -k1,168:20990497,16635057:141820 -k1,168:22323762,16635057:141820 -k1,168:24361538,16635057:141819 -k1,168:26070979,16635057:141820 -k1,168:27784352,16635057:141820 -k1,168:28577600,16635057:141820 -k1,168:30690087,16635057:141819 -k1,168:31649796,16635057:141820 +k1,168:8362000,16635057:136736 +k1,168:9150164,16635057:136736 +k1,168:12554525,16635057:136736 +k1,168:14062274,16635057:136736 +k1,168:15577232,16635057:136736 +k1,168:17769177,16635057:136736 +k1,168:21026082,16635057:136736 +k1,168:22354264,16635057:136737 +k1,168:24386957,16635057:136736 +k1,168:26091314,16635057:136736 +k1,168:27799603,16635057:136736 +k1,168:28587767,16635057:136736 +k1,168:30695171,16635057:136736 +k1,168:31649796,16635057:136736 k1,168:32583029,16635057:0 ) (1,169:6630773,17500137:25952256,505283,134348 @@ -38028,16 +38027,16 @@ k1,171:30486533,34467485:141012 k1,171:32583029,34467485:0 ) (1,172:6630773,35332565:25952256,513147,134348 -k1,171:8782517,35332565:242680 -k1,171:9684489,35332565:242680 -k1,171:11393864,35332565:242679 -k1,171:14377260,35332565:242680 -k1,171:17470756,35332565:242680 -k1,171:19729323,35332565:242680 -k1,171:21163448,35332565:242680 -k1,171:26316084,35332565:242679 -k1,171:27952715,35332565:242680 -k1,171:29818066,35332565:242680 +k1,171:8785990,35332565:246153 +k1,171:9691435,35332565:246153 +k1,171:11404285,35332565:246154 +k1,171:14391154,35332565:246153 +k1,171:17488123,35332565:246153 +k1,171:19750163,35332565:246153 +k1,171:21187761,35332565:246153 +k1,171:26343872,35332565:246154 +k1,171:27983976,35332565:246153 +k1,171:29852800,35332565:246153 k1,171:32583029,35332565:0 ) (1,172:6630773,36197645:25952256,513147,134348 @@ -38173,14 +38172,14 @@ g1,178:30312205,43465626 g1,178:32583028,43465626 g1,178:32583028,43465626 ) -(1,180:6630773,44330706:25952256,505283,126483 -k1,180:23425029,44330706:16794256 -h1,179:23425029,44330706:0,0,0 -g1,179:26283054,44330706 -g1,179:27925386,44330706 -g1,179:31008854,44330706 -g1,180:32583029,44330706 -g1,180:32583029,44330706 +(1,180:6630773,44330706:25952256,505283,102891 +k1,180:24701669,44330706:18070896 +h1,179:24701669,44330706:0,0,0 +g1,179:27559694,44330706 +g1,179:28803567,44330706 +g1,179:31008853,44330706 +g1,180:32583028,44330706 +g1,180:32583028,44330706 ) ] (1,183:32583029,45706769:0,0,0 @@ -38203,7 +38202,7 @@ g1,183:-473656,-710413 ] ) ] -!20858 +!20826 }15 !11 {16 @@ -42324,11 +42323,11 @@ k1,326:3078556,49800853:-34777008 ] g1,326:6630773,4812305 g1,326:6630773,4812305 -g1,326:9478312,4812305 -g1,326:12332404,4812305 -g1,326:13131287,4812305 -g1,326:16211479,4812305 -k1,326:32184570,4812305:15973091 +g1,326:9189953,4812305 +g1,326:12044045,4812305 +g1,326:12842928,4812305 +g1,326:15923120,4812305 +k1,326:32184570,4812305:16261450 ) ) ] @@ -42445,10 +42444,10 @@ r1,326:32583029,12545577:25952256,32768,0 g1,307:6630773,14177429 g1,307:8605504,14177429 ) -g1,307:12245898,14177429 -g1,307:15952352,14177429 -g1,307:16988870,14177429 -k1,307:32583029,14177429:11889278 +g1,307:11833808,14177429 +g1,307:15540262,14177429 +g1,307:16576780,14177429 +k1,307:32583029,14177429:12301368 g1,307:32583029,14177429 ) (1,309:6630773,15507815:25952256,555811,139132 @@ -43857,11 +43856,11 @@ k1,361:3078556,49800853:-34777008 ] g1,361:6630773,4812305 g1,361:6630773,4812305 -g1,361:9478312,4812305 -g1,361:12332404,4812305 -g1,361:13131287,4812305 -g1,361:16211479,4812305 -k1,361:32184570,4812305:15973091 +g1,361:9189953,4812305 +g1,361:12044045,4812305 +g1,361:12842928,4812305 +g1,361:15923120,4812305 +k1,361:32184570,4812305:16261450 ) ) ] @@ -458530,6 +458529,6 @@ h1,25048:4262630,4025873:0,0,0 Input:4640:C:\Users\aphalo\Documents\manuscripts\Books\learnr-book-crc\learn-r-2ed-crc.aux !103 Postamble: -Count:453884 +Count:453883 !29 Post scriptum: diff --git a/learn-r-2ed-crc.toc b/learn-r-2ed-crc.toc index 126e5607..b655eb49 100644 --- a/learn-r-2ed-crc.toc +++ b/learn-r-2ed-crc.toc @@ -9,7 +9,7 @@ \contentsline {subsection}{\numberline {1.3.1}Call-outs}{3}{}% \contentsline {subsection}{\numberline {1.3.2}Code conventions and syntax highlighting}{4}{}% \contentsline {subsection}{\numberline {1.3.3}Diagrams}{4}{}% -\contentsline {section}{\numberline {1.4}Findings Answers to Problems}{5}{}% +\contentsline {section}{\numberline {1.4}Finding Answers to Problems}{5}{}% \contentsline {subsection}{\numberline {1.4.1}What are the options?}{5}{}% \contentsline {subsection}{\numberline {1.4.2}\textsf {R}\xspace 's built-in help}{5}{}% \contentsline {subsection}{\numberline {1.4.3}Online forums}{6}{}% diff --git a/learnr-book-crc-final-2024-03-05.zip b/learnr-book-crc-final-2024-03-05.zip new file mode 100644 index 00000000..f0bc3319 Binary files /dev/null and b/learnr-book-crc-final-2024-03-05.zip differ diff --git a/preface.Rnw b/preface.Rnw index 7c2f462b..ff8b9fa0 100644 --- a/preface.Rnw +++ b/preface.Rnw @@ -17,16 +17,16 @@ A language is a system of communication. Basic concepts and operations are based Using a language actively is the most efficient way of learning it. By using it, I mean actually reading, writing, and running scripts or programs. \emph{Learn R: As a Language} supports learning the \Rlang language in a way comparable to how children learn to speak: they work out what the rules are, simply by listening to people speak and trying to utter what they want to tell their parents. Of course, small children also receive guidance through feedback, but they are not taught a prescriptive set of rules like when learning a second language at school. Instead of listening, readers will read and run code, and instead of speaking, readers will write and try to run \Rlang-language code on a computer. I do provide explanations and guidance, as understanding how \Rlang works greatly helps with its use. However, the approach I encourage in this book is for readers to play with the numerous examples and to create variations upon them, to find out by themselves the patterns behind the \Rlang language. Instead of parents being the sounding board for the first utterances of readers new to \Rlang, the computer will play this role. Although working through the examples in \emph{Learn R: As a Language} in a group of peers or in class is beneficial, the book is designed to be useful also in the absence of such support. -\paragraph*{Changes in the second edition.} I edited the text from the first edition to correct all errors and outdated examples or explanations known to me. This revised second edition reflects changes in \Rlang and the contributed packages used in the book. Very little of the code from the first edition had stopped working but deprecations meant that a few examples triggered messages or warnings, and will eventually fail. Recent ($>$\,4.0.0) versions of \Rlang have significant enhancements including the new pipe operator described and used in this second edition. Packages have also evolved acquiring new features like a new approach to flipping plots in \pkgname{ggplot2}. +\paragraph*{Changes in the second edition:} I edited the text from the first edition to correct all errors and outdated examples or explanations known to me. This revised second edition reflects changes in \Rlang and the contributed packages used in the book. Very little of the code from the first edition had stopped working but deprecations meant that a few examples triggered messages or warnings, and will eventually fail. Recent ($>$\,4.0.0) versions of \Rlang have significant enhancements, including the new pipe operator described and used in this second edition. Packages have also evolved, acquiring new features like a new approach to flipping plots in \pkgname{ggplot2}. I have aimed at making the book more accessible to readers with no previous experience in computer programming. Feedback from readers and reviewers highlighted a few gaps in the content and some difficult-to-follow explanations. I revised the text, in some cases changing the sequence of presentation. I added diagrams to illustrate the structure of different types of objects and flowcharts to describe how program constructs work. I added tables listing groups of related functions. New sections cover character string operations, and details of data wrangling in \Rlang. Some of the most frequently asked questions about \Rlang are answered in the text and separately indexed. All exercises or ``playgrounds'' are numbered to facilitate their use as class work and the sharing of model answers. As the first edition has been frequently found useful as a reference, I expanded the already thorough indexing and added more cross-references connecting related sections across the whole book. An additional change is in my view about packages \pkgnameNI{dplyr} and \pkgnameNI{tidyr}, part of the \pkgname{tidyverse}. I have come to think that the rate of development of these two packages can make them difficult for users for whom data analysis is just one aspect of their occupation. As these packages are widely used, I emphasise more than in the first edition the differences between functions and classes from packages \pkgnameNI{dplyr} and \pkgnameNI{tidyr} and equivalent ones from base \Rlang. I added a section on working with dates and times using the \pkgnameNI{lubridate} package. I updated and reorganised the chapter describing package \pkgname{ggplot2} and some of its extensions. -In numbers, the page count has increased by 27\%, the number of figures from eight to twenty six plus nine in-text diagrams, and tables from none to seven. As for the design, text boxes have been replaced by call-outs marked with marginal bars. In addition, starting from version 2.0.0, the \pkgname{learnrbook} package supports the first and second editions of the book. It contains data, scripts, and all the code examples from both editions. It also helps with the installation of all the packages used in the book. The website at \url{https://www.learnr-book.info/} provides updated open-access content. +In numbers, the page count has increased by 27\%, the number of figures from eight to twenty-six plus nine in-text diagrams, and tables from none to seven. As for the design, text boxes have been replaced by call-outs marked with marginal bars. In addition, starting from version 2.0.0, the \pkgname{learnrbook} package supports the first and second editions of the book. It contains data, scripts, and all the code examples from both editions. It also helps with the installation of all the packages used in the book. The website at \url{https://www.learnr-book.info/} provides updated open-access content. \section*{Acknowledgements} -I thank Jaakko Heinonen for introducing me in the late 1990s to the then new \Rlang. Along the way many experts have answered my questions in usenet and more recently in \stackoverflow. I wish to warmly thank members of my research group, students, collaborators, authors of books, and people I have met online or at conferences. They have made it possible for me to write this book. I am specially indebted to Dan Yavorsky, Tarja Lehto, Titta Kotilainen, Tautvydas Zalnierius, Fang Wang, Yan Yan, Neha Rai, Markus Laurel, Brett Cooper, Viivi Lindholm, Mat\v{e}j Rzehulka, Zuzana Svarna, colleagues, students, and anonymous reviewers for many very helpful comments on the draft manuscript and/or the first edition. Rob Calver, editor of both editions, provided advice and encouragement with great patience, Paul Boyd, Shashi Kumar, Ashraf Reza, Vaishali Singh, Lara Spieker, and Sherry Thomas efficiently helped with different aspects of this project. +I thank Jaakko Heinonen for introducing me in the late 1990s to the then new \Rlang. Along the way many experts have answered my questions in usenet and more recently in \stackoverflow. I wish to warmly thank members of my research group, students, collaborators, authors of books, and people I have met online or at conferences. They have made it possible for me to write this book. I am specially indebted to Dan Yavorsky, Tarja Lehto, Titta Kotilainen, Tautvydas Zalnierius, Fang Wang, Yan Yan, Neha Rai, Markus Laurel, Brett Cooper, Viivi Lindholm, Mat\v{e}j Rzehulka, Zuzana Svarna, colleagues, students, and anonymous reviewers for many very helpful comments on the draft manuscript and/or the first edition. Rob Calver, editor of both editions, provided advice and encouragement with great patience. Paul Boyd, Shashi Kumar, Ashraf Reza, Vaishali Singh, Lara Spieker, and Sherry Thomas efficiently helped with different aspects of this project. The writing of this second edition was helped by a six-month sabbatical granted by the Faculty of Biological and Environmental Sciences of the University of Helsinki, Finland. I thank Prof.\ Kurt Fagerstedt for his support.