From a03237d4359e97c93a8be1201f77f898210f7d19 Mon Sep 17 00:00:00 2001 From: jrnold Date: Fri, 17 May 2019 23:58:33 -0700 Subject: [PATCH] new link-checker; fix links --- README.md | 2 +- _common.R | 4 +- _config.yml | 2 +- functions.Rmd | 4 +- import.Rmd | 2 +- index.Rmd | 8 +- intro.Rmd | 4 +- iteration.Rmd | 4 +- model-basics.Rmd | 2 +- model-building.Rmd | 2 +- package-lock.json | 407 ++++++++++++++++++++++++++++++++++++++++++- package.json | 4 +- strings.Rmd | 2 +- tidy.Rmd | 2 +- transform.Rmd | 8 +- vectors.Rmd | 4 +- workflow-scripts.Rmd | 2 +- 17 files changed, 429 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 7b7729df..e2edd5f0 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ # Exercise Solutions to R for Data Science -This repository contains the code and text behind the [Solutions for R for Data Science](https://jrnold.github.io/r4ds-exercise-solutions/), which, as its name suggests, has solutions to the the exercises in [R for Data Science](http://r4ds.had.co.nz/) by Garrett Grolemund and Hadley Wickham. +This repository contains the code and text behind the [Solutions for R for Data Science](https://jrnold.github.io/r4ds-exercise-solutions/), which, as its name suggests, has solutions to the the exercises in [R for Data Science](https://r4ds.had.co.nz/) by Garrett Grolemund and Hadley Wickham. The R packages used in this book can be installed via ```r diff --git a/_common.R b/_common.R index 13c7c9e2..bf939db0 100644 --- a/_common.R +++ b/_common.R @@ -26,12 +26,12 @@ SOURCE_URL <- stringr::str_c("https:/", "github.com", "jrnold", "r4ds-exercise-solutions", sep = "/" ) -PUB_URL <- stringr::str_c("http:/", "jrnold.github.io", +PUB_URL <- stringr::str_c("https:/", "jrnold.github.io", "r4ds-exercise-solutions", sep = "/" ) -R4DS_URL <- "http://r4ds.had.co.nz" +R4DS_URL <- "https://r4ds.had.co.nz" r4ds_url <- function(...) { stringr::str_c(R4DS_URL, ..., sep = "/") diff --git a/_config.yml b/_config.yml index 58ec08b9..335b0804 100644 --- a/_config.yml +++ b/_config.yml @@ -1,5 +1,5 @@ github_repo: "jrnold/r4ds-exercise-solutions" -deploy_url: "https://jrnold.github.io/r4ds-exercise-solutions" +deploy_url: "https://jrnold.github.io/r4ds-exercise-solutions/" r4ds: github_repo: "hadley/r4ds" url: "https://r4ds.had.co.nz" diff --git a/functions.Rmd b/functions.Rmd index 3251edc0..fe42997e 100644 --- a/functions.Rmd +++ b/functions.Rmd @@ -154,7 +154,7 @@ coef_variation(c(1:5, NA), na.rm = TRUE)
-Follow to write your own functions to compute the variance and skew of a numeric vector. +Follow to write your own functions to compute the variance and skew of a numeric vector.
@@ -697,7 +697,7 @@ Why doesn’t this currently work? How could you fix it?
-This is the definition of the rule function from the [chapter](http://r4ds.had.co.nz/functions.html). +This is the definition of the rule function from the [chapter](https://r4ds.had.co.nz/functions.html). ```{r} rule <- function(..., pad = "-") { title <- paste0(...) diff --git a/import.Rmd b/import.Rmd index cd27b4a9..28da9a80 100644 --- a/import.Rmd +++ b/import.Rmd @@ -290,7 +290,7 @@ The list in the documentation for `stringi::stri_enc_detect()` is a good list of For more information on character encodings see the following sources. - The Wikipedia page [Character encoding](https://en.wikipedia.org/wiki/Character_encoding), has a good list of encodings. -- Unicode [CLDR](http://cldr.unicode.org/) project +- Unicode [CLDR](https://cldr.unicode.org/) project - [What is the most common encoding of each language](https://stackoverflow.com/questions/8509339/what-is-the-most-common-encoding-of-each-language) (Stack Overflow) - "What Every Programmer Absolutely, Positively Needs To Know About Encodings And Character Sets To Work With Text", . diff --git a/index.Rmd b/index.Rmd index a4a925f1..184225d6 100644 --- a/index.Rmd +++ b/index.Rmd @@ -27,9 +27,9 @@ knitr::opts_chunk$set(cache = FALSE) Cover image -This book contains the **exercise solutions** for the book [*R for Data Science*](http://amzn.to/2aHLAQ1), by Hadley Wickham and Garret Grolemund [@WickhamGrolemund2017]. +This book contains the **exercise solutions** for the book [*R for Data Science*](https://amzn.to/2aHLAQ1), by Hadley Wickham and Garret Grolemund [@WickhamGrolemund2017]. -*R for Data Science* itself is available online at [r4ds.had.co.nz](http://r4ds.had.co.nz/), and physical copy is published by O'Reilly Media and available from [amazon](http://amzn.to/2aHLAQ1). +*R for Data Science* itself is available online at [r4ds.had.co.nz](https://r4ds.had.co.nz/), and physical copy is published by O'Reilly Media and available from [amazon](https://amzn.to/2aHLAQ1). ## Acknowledgments {-} @@ -117,10 +117,10 @@ A special thanks to: - [\@dongzhuoer](https://github.com/dongzhuoer) and [\@cfgauss](https://hypothes.is/users/cfgauss) for careful readings of the book and noticing numerous issues and proposing fixes. Thank you to all of those who contributed issues or pull-requests on -[GitHub](https://github.com/jrnold/r4ds-exercise-solutions/graphs/contributors) +[GitHub](https://github.com/jrnold/r4ds-exercise-solutions/graphs/contributors) (in alphabetical order): `r github_contribs()` Thank you to all of you who contributed annotations on [hypothes.is](https://hypothes.is/search?q=url%3Ajrnold.github.io%2Fr4ds-exercise-solutions%2F*) (in alphabetical order): `r hypothesis_contribs()`. ## License {-} -This work is licensed under a Creative Commons Attribution 4.0 International License. +This work is licensed under a Creative Commons Attribution 4.0 International License. diff --git a/intro.Rmd b/intro.Rmd index 9d2b1e38..5d2e23cb 100644 --- a/intro.Rmd +++ b/intro.Rmd @@ -15,7 +15,7 @@ The text for each exercise is followed by the solution. Like *R for Data Science*, packages used in each chapter are loaded in a code chunk at the start of the chapter in a section titled "Prerequisites". If exercises depend on code in a section of *R for Data Science* it is either provided before the exercises or within the exercise solution. -If a package is used infrequently in solutions it may not be loaded, and functions using it will be called using the package name followed by two colons, as in `dplyr::mutate()` (see the *R for Data Science* [Introduction](http://r4ds.had.co.nz/introduction.html#running-r-code)). +If a package is used infrequently in solutions it may not be loaded, and functions using it will be called using the package name followed by two colons, as in `dplyr::mutate()` (see the *R for Data Science* [Introduction](https://r4ds.had.co.nz/introduction.html#running-r-code)). The double colon may also be used to be explicit about the package from which a function comes. ## Prerequisites {-} @@ -49,7 +49,7 @@ github_full_url <- stringr::str_c(SOURCE_URL, "tree", r_sha, sep = "/") ``` HTML and PDF versions of this book are available at <`r PUB_URL`>. -The book is powered by [bookdown](https://bookdown.org) which makes it easy to turn R markdown files into HTML, PDF, and EPUB. +The book is powered by [bookdown](https://bookdown.org/home) which makes it easy to turn R markdown files into HTML, PDF, and EPUB. The source of this book is available on GitHub at <`r SOURCE_URL`>. This book was built from commit [`r r_sha_short`](`r github_full_url`). diff --git a/iteration.Rmd b/iteration.Rmd index 6d1429cc..a7feef7a 100644 --- a/iteration.Rmd +++ b/iteration.Rmd @@ -166,7 +166,7 @@ Combine your function writing and for loop skills: The answers to each part follow. -1. The lyrics for [Alice the Camel](http://www.kididdles.com/lyrics/a012.html) are: +1. The lyrics for [Alice the Camel](https://www.kididdles.com/lyrics/a012.html) are: > Alice the camel has five humps. \ > Alice the camel has five humps. \ @@ -634,7 +634,7 @@ Write code that uses one of the map functions to: ``` 1. To calculate the type of every column in `nycflights13::flights` apply - the function `typeof()`, discussed in the section on [Vector basics](http://r4ds.had.co.nz/vectors.html#vector-basics), + the function `typeof()`, discussed in the section on [Vector basics](https://r4ds.had.co.nz/vectors.html#vector-basics), and use `map_chr()`, since the results are character. ```{r} map_chr(nycflights13::flights, typeof) diff --git a/model-basics.Rmd b/model-basics.Rmd index 559c07bf..0f449244 100644 --- a/model-basics.Rmd +++ b/model-basics.Rmd @@ -148,7 +148,7 @@ best$par ``` In practice, I suggest not using `optim()` to fit this model, and instead using an existing implementation. -The `rlm()` and `lqs()` functions in the [MASS](https://cran.r-project.org/package=MASS) fit robust and resistant linear models. +The `rlm()` and `lqs()` functions in the [MASS](https://CRAN.R-project.org/package=MASS) fit robust and resistant linear models.
diff --git a/model-building.Rmd b/model-building.Rmd index 0bbda8cf..53918b83 100644 --- a/model-building.Rmd +++ b/model-building.Rmd @@ -643,7 +643,7 @@ Write a small function to set the levels of the factor so that the week starts o
-See the chapter [Factors](http://r4ds.had.co.nz/factors.html) for the function `fct_relevel()`. +See the chapter [Factors](https://r4ds.had.co.nz/factors.html) for the function `fct_relevel()`. Use `fct_relevel()` to put all levels in-front of the first level ("Sunday"). ```{r} diff --git a/package-lock.json b/package-lock.json index 069524bc..db113b62 100644 --- a/package-lock.json +++ b/package-lock.json @@ -259,6 +259,12 @@ "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==", "dev": true }, + "boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=", + "dev": true + }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -321,6 +327,12 @@ "unset-value": "^1.0.0" } }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", @@ -357,6 +369,53 @@ "integrity": "sha512-VOq6PRzQBam/8Jm6XBGk2fNEnHXAdGd6go0rtd4weAGECBamHDwwCQSOT12TACIYUZegUXnV6xBXqUssijtxIg==", "dev": true }, + "cheerio": { + "version": "1.0.0-rc.3", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.3.tgz", + "integrity": "sha512-0td5ijfUPuubwLUu0OBoe98gZj8C/AA+RW3v67GPlGOrvxWjZmBXiBCRU+I8VEiNyJzjth40POfHiz2RB3gImA==", + "dev": true, + "requires": { + "css-select": "~1.2.0", + "dom-serializer": "~0.1.1", + "entities": "~1.1.1", + "htmlparser2": "^3.9.1", + "lodash": "^4.15.0", + "parse5": "^3.0.1" + }, + "dependencies": { + "entities": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", + "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==", + "dev": true + }, + "htmlparser2": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", + "integrity": "sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==", + "dev": true, + "requires": { + "domelementtype": "^1.3.1", + "domhandler": "^2.3.0", + "domutils": "^1.5.1", + "entities": "^1.1.1", + "inherits": "^2.0.1", + "readable-stream": "^3.1.1" + } + }, + "readable-stream": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.3.0.tgz", + "integrity": "sha512-EsI+s3k3XsW+fU8fQACLN59ky34AZ14LoeVZpYwmZvldCFo0r0gnelwF2TcMjLor/BTL5aDJVBMkss0dthToPw==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, "chokidar": { "version": "2.1.6", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.6.tgz", @@ -649,6 +708,12 @@ "date-now": "^0.1.4" } }, + "cookiejar": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz", + "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA==", + "dev": true + }, "copy-descriptor": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", @@ -674,6 +739,24 @@ "which": "^1.2.9" } }, + "css-select": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", + "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", + "dev": true, + "requires": { + "boolbase": "~1.0.0", + "css-what": "2.1", + "domutils": "1.5.1", + "nth-check": "~1.0.1" + } + }, + "css-what": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.3.tgz", + "integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==", + "dev": true + }, "csslint": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/csslint/-/csslint-1.0.5.tgz", @@ -786,7 +869,6 @@ "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz", "integrity": "sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA==", "dev": true, - "optional": true, "requires": { "domelementtype": "^1.3.0", "entities": "^1.1.1" @@ -796,8 +878,7 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==", - "dev": true, - "optional": true + "dev": true } } }, @@ -805,15 +886,13 @@ "version": "1.3.1", "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==", - "dev": true, - "optional": true + "dev": true }, "domhandler": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.3.0.tgz", "integrity": "sha1-LeWaCCLVAn+r/28DLCsloqir5zg=", "dev": true, - "optional": true, "requires": { "domelementtype": "1" } @@ -823,7 +902,6 @@ "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz", "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", "dev": true, - "optional": true, "requires": { "dom-serializer": "0", "domelementtype": "1" @@ -1096,6 +1174,12 @@ "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", "dev": true }, + "foreachasync": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/foreachasync/-/foreachasync-3.0.0.tgz", + "integrity": "sha1-VQKYfchxS+M5IJfzLgBxyd7gfPY=", + "dev": true + }, "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", @@ -1119,6 +1203,12 @@ "integrity": "sha1-1hcBB+nv3E7TDJ3DkBbflCtctYs=", "dev": true }, + "formidable": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.1.tgz", + "integrity": "sha512-Fs9VRguL0gqGHkXS5GQiMCr1VhZBxz0JnJs4JmMp/2jL18Fmbzvv7vOFRU+U8TBkHEE/CX1qDXzJplVULgsLeg==", + "dev": true + }, "fragment-cache": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", @@ -1892,6 +1982,15 @@ "sshpk": "^1.7.0" } }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, "ignore": { "version": "3.3.10", "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz", @@ -2295,6 +2394,189 @@ "invert-kv": "^2.0.0" } }, + "link-checker": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/link-checker/-/link-checker-1.2.1.tgz", + "integrity": "sha512-Ln1YaCM1gkfhfsyknBHZsPpmKXsJ0CEyk31CVms9KCsYAl356rCXmJ2/eobKo6xWfjYbw299Pfg2bWKlTvFKbQ==", + "dev": true, + "requires": { + "cheerio": "^1.0.0-rc.2", + "commander": "^2.15.0", + "debug": "^3.1.0", + "superagent": "^3.8.3", + "urlencode": "^1.1.0", + "walk": "^2.3.9", + "yargs": "^11.0.0" + }, + "dependencies": { + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true, + "requires": { + "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "execa": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "dev": true, + "requires": { + "cross-spawn": "^5.0.1", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, + "invert-kv": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", + "dev": true + }, + "lcid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "dev": true, + "requires": { + "invert-kv": "^1.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "mem": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", + "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", + "dev": true, + "requires": { + "mimic-fn": "^1.0.0" + } + }, + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + }, + "os-locale": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", + "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", + "dev": true, + "requires": { + "execa": "^0.7.0", + "lcid": "^1.0.0", + "mem": "^1.1.0" + } + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + }, + "y18n": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", + "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", + "dev": true + }, + "yargs": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-11.1.0.tgz", + "integrity": "sha512-NwW69J42EsCSanF8kyn5upxvjp5ds+t3+udGBeTbFnERA+lF541DDpMawzo4z6W/QrzNM18D+BPMiOBibnFV5A==", + "dev": true, + "requires": { + "cliui": "^4.0.0", + "decamelize": "^1.1.1", + "find-up": "^2.1.0", + "get-caller-file": "^1.0.1", + "os-locale": "^2.0.0", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^2.0.0", + "which-module": "^2.0.0", + "y18n": "^3.2.1", + "yargs-parser": "^9.0.2" + } + }, + "yargs-parser": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-9.0.2.tgz", + "integrity": "sha1-nM9qQ0YP5O1Aqbto9I1DuKaMwHc=", + "dev": true, + "requires": { + "camelcase": "^4.1.0" + } + } + } + }, "load-plugin": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/load-plugin/-/load-plugin-2.3.1.tgz", @@ -2315,12 +2597,28 @@ "path-exists": "^3.0.0" } }, + "lodash": { + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + }, "longest-streak": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-2.0.3.tgz", "integrity": "sha512-9lz5IVdpwsKLMzQi0MQ+oD9EA0mIGcWYP7jXMTZVXP8D42PwuAk+M/HBFYQoxt1G5OR8m7aSIgb1UymfWGBWEw==", "dev": true }, + "lru-cache": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", + "dev": true, + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, "map-age-cleaner": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", @@ -2401,6 +2699,12 @@ "p-is-promise": "^2.0.0" } }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=", + "dev": true + }, "micromatch": { "version": "3.1.10", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", @@ -2422,6 +2726,12 @@ "to-regex": "^3.0.2" } }, + "mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "dev": true + }, "mime-db": { "version": "1.40.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", @@ -2555,6 +2865,15 @@ "path-key": "^2.0.0" } }, + "nth-check": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz", + "integrity": "sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg==", + "dev": true, + "requires": { + "boolbase": "~1.0.0" + } + }, "number-is-nan": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", @@ -2720,6 +3039,15 @@ "json-parse-better-errors": "^1.0.1" } }, + "parse5": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-3.0.3.tgz", + "integrity": "sha512-rgO9Zg5LLLkfJF9E6CCmXlSE4UVceloys8JrFqCcHloC3usd/kJCyPDwH2SOlzix2j3xaP9sUX3e8+kvkuleAA==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, "parserlib": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/parserlib/-/parserlib-1.1.1.tgz", @@ -2796,6 +3124,12 @@ "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", "dev": true }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, "psl": { "version": "1.1.31", "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.31.tgz", @@ -4337,6 +4671,41 @@ "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "dev": true }, + "superagent": { + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/superagent/-/superagent-3.8.3.tgz", + "integrity": "sha512-GLQtLMCoEIK4eDv6OGtkOoSMt3D+oq0y3dsxMuYuDvaNUvuT8eFBuLmfR0iYYzHC1e8hpzC6ZsxbuP6DIalMFA==", + "dev": true, + "requires": { + "component-emitter": "^1.2.0", + "cookiejar": "^2.1.0", + "debug": "^3.1.0", + "extend": "^3.0.0", + "form-data": "^2.3.1", + "formidable": "^1.2.0", + "methods": "^1.1.1", + "mime": "^1.4.1", + "qs": "^6.5.1", + "readable-stream": "^2.3.5" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } + } + }, "text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -4786,6 +5155,15 @@ "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", "dev": true }, + "urlencode": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/urlencode/-/urlencode-1.1.0.tgz", + "integrity": "sha1-HyuibwE8hfATP3o61v8nMK33y7c=", + "dev": true, + "requires": { + "iconv-lite": "~0.4.11" + } + }, "use": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", @@ -4883,6 +5261,15 @@ "integrity": "sha512-16wAC9eEGXdsD35LX9m/iXCRIZyX5LIrDgDtAF92rbATSqsBRbC4n05e0Rj5vt3XRpcKu0UJeWnTxWsSyvNZ+w==", "dev": true }, + "walk": { + "version": "2.3.14", + "resolved": "https://registry.npmjs.org/walk/-/walk-2.3.14.tgz", + "integrity": "sha512-5skcWAUmySj6hkBdH6B6+3ddMjVQYH5Qy9QGbPmN8kVmLteXk+yVXg+yfk1nbX30EYakahLrr8iPcCxJQSCBeg==", + "dev": true, + "requires": { + "foreachasync": "^3.0.0" + } + }, "which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", @@ -4964,6 +5351,12 @@ "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", "dev": true }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + }, "yargs": { "version": "12.0.5", "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.5.tgz", diff --git a/package.json b/package.json index 3ac692d7..12528b8f 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "scripts": { "test-html": "htmlhint _build/**/*.html", "test-markdown": "remark --frail *.Rmd rmarkdown/*.Rmd README.md .github/*.md", - "test": "concurrently npm:test-html npm:test-markdown" + "test-links": "link-checker _build --http-status-ignore 302 --http-status-ignore 403 --http-status-ignore 301 --http-status-ignore 307 --http-status-ignore 303 --http-timeout 10000", + "test": "concurrently npm:test-html npm:test-markdown npm:test-links" }, "repository": { "type": "git", @@ -19,6 +20,7 @@ "devDependencies": { "concurrently": "^4.1.0", "htmlhint": "^0.10.3", + "link-checker": "^1.2.1", "remark": "^9.0.0", "remark-cli": "^6.0.1", "remark-frontmatter": "^1.3.1", diff --git a/strings.Rmd b/strings.Rmd index d373c4ac..116ff825 100644 --- a/strings.Rmd +++ b/strings.Rmd @@ -411,7 +411,7 @@ because of unassigned area code, or special numbers like 911, or extensions. See the Wikipedia page for the [North American Numbering Plan](https://en.wikipedia.org/wiki/North_American_Numbering_Plan) for more information on the complexities of US phone numbers, and [this Stack Overflow -question](http://stackoverflow.com/questions/123559/a-comprehensive-regex-for-phone-number-validation) +question](https://stackoverflow.com/questions/123559/a-comprehensive-regex-for-phone-number-validation) for a discussion of using a regex for phone number validation.
diff --git a/tidy.Rmd b/tidy.Rmd index 2145678b..91bf5fb4 100644 --- a/tidy.Rmd +++ b/tidy.Rmd @@ -341,7 +341,7 @@ preg_tidy2 <- preg %>% preg_tidy2 ``` -This an example of turning an explicit missing value into an implicit missing value, which is discussed in the upcoming [Missing Values](http://r4ds.had.co.nz/tidy-data.html#missing-values-3) section. +This an example of turning an explicit missing value into an implicit missing value, which is discussed in the upcoming [Missing Values](https://r4ds.had.co.nz/tidy-data.html#missing-values-3) section. The missing (male, pregnant) row represents is an implicit missing value because the missing value of `count` can be inferred from its absence. In the tidy data, we can represent rows with missing values of `count` either explicitly with an `NA` (as in `preg_tidy`) or implicitly by the absence of a row (as in `preg_tidy2`). But in the wide data, the missing values can only be represented explicitly. diff --git a/transform.Rmd b/transform.Rmd index 62aa3d42..c2eb5810 100644 --- a/transform.Rmd +++ b/transform.Rmd @@ -407,7 +407,7 @@ These are a few ways to select columns. - Selecting the variables using regular expressions with `matches()`. Regular expressions provide a flexible way to match string patterns - and are discussed in the [Strings](http://r4ds.had.co.nz/strings.html) chapter. + and are discussed in the [Strings](https://r4ds.had.co.nz/strings.html) chapter. ```{r} select(flights, matches("^(dep|arr)_(time|delay)$")) ``` @@ -535,7 +535,7 @@ Dividing by 100 and discarding the remainder using the integer division operator Instead of `%/%` could also use `/` along with `trunc()` or `floor()`, but `round()` would not work. To get the minutes, instead of discarding the remainder of the division by `100`, we only want the remainder. -So we use the modulo operator, `%%`, discussed in the [Other Useful Functions](http://r4ds.had.co.nz/transform.html#select) section. +So we use the modulo operator, `%%`, discussed in the [Other Useful Functions](https://r4ds.had.co.nz/transform.html#select) section. ```{r} 1504 %% 100 ``` @@ -566,7 +566,7 @@ select( ) ``` -Looking ahead to the [Functions](http://r4ds.had.co.nz/functions.html) chapter, +Looking ahead to the [Functions](https://r4ds.had.co.nz/functions.html) chapter, this is precisely the sort of situation in which it would make sense to write a function to avoid copying and pasting code. We could define a function `time2mins()`, which converts a vector of times in @@ -1140,7 +1140,7 @@ flights %>% ``` There are more sophisticated ways to do this analysis, however comparing the delay of flights within each route goes a long ways toward disentangling airport and carrier effects. -To see a more complete example of this analysis, see this FiveThirtyEight [piece](http://fivethirtyeight.com/features/the-best-and-worst-airlines-airports-and-flights-summer-2015-update/). +To see a more complete example of this analysis, see this FiveThirtyEight [piece](https://fivethirtyeight.com/features/the-best-and-worst-airlines-airports-and-flights-summer-2015-update/). diff --git a/vectors.Rmd b/vectors.Rmd index 9c4b849b..03991d24 100644 --- a/vectors.Rmd +++ b/vectors.Rmd @@ -275,7 +275,7 @@ The expression `sum(!is.finite(x))` calculates the number of elements in the vec sum(!is.finite(x)) ``` -Review the [Numeric](http://r4ds.had.co.nz/vectors.html#numeric) section for the differences between `is.na()` and `is.finite()`. +Review the [Numeric](https://r4ds.had.co.nz/vectors.html#numeric) section for the differences between `is.na()` and `is.finite()`. @@ -737,4 +737,4 @@ In following chapters we'll see that list vectors can be very useful: for exampl -[^DiagrammeR]: These diagrams were created with the [DiagrammeR](http://rich-iannone.github.io/DiagrammeR/) package. +[^DiagrammeR]: These diagrams were created with the [DiagrammeR](https://rich-iannone.github.io/DiagrammeR/) package. diff --git a/workflow-scripts.Rmd b/workflow-scripts.Rmd index af169bef..568a2d01 100644 --- a/workflow-scripts.Rmd +++ b/workflow-scripts.Rmd @@ -40,6 +40,6 @@ You should read that page, but some other diagnostics for R code include the fol 1. Check for missing, unmatched, partially matched, and too many arguments to functions. 1. Warn if a variable is not defined. 1. Warn if a variable is defined but not used. -1. Check that the code style conforms to the [tidyverse style guide](http://adv-r.had.co.nz/Style.html). +1. Check that the code style conforms to the [tidyverse style guide](https://style.tidyverse.org/).