diff --git a/data-structures.Rmd b/data-structures.Rmd index 6289728..cfd4fc9 100644 --- a/data-structures.Rmd +++ b/data-structures.Rmd @@ -9,7 +9,7 @@ As you start to write more functions, and as you want your functions to work wit The most important family of objects in R are __vectors__. Vectors are broken down into __atomic__ vectors, and __lists__. There are six types of atomic vector, but only four are in common use: logical, integer, double, and character. The chief difference between atomic vectors and lists is that atomic atomic vectors are homogeneous (every element is the same type) and lists are heterogeneous (each element can be a different type). -```{r, echo = FALSE, out.width = NA, out.height = NA} +```{r, echo = FALSE} knitr::include_graphics("diagrams/data-structures-overview.png") ``` diff --git a/functions.Rmd b/functions.Rmd index bfe5e4f..1739bce 100644 --- a/functions.Rmd +++ b/functions.Rmd @@ -1,4 +1,4 @@ -```{r, include = FALSE} +```{r setup, include = FALSE} library(stringr) ``` diff --git a/index.rmd b/index.rmd index b938e20..827c7bc 100644 --- a/index.rmd +++ b/index.rmd @@ -1,8 +1,6 @@ --- knit: "bookdown::render_book" title: "R for Data Science" -output: - - bookdown::gitbook --- # Welcome diff --git a/model.Rmd b/model.Rmd index db50360..d5727ec 100644 --- a/model.Rmd +++ b/model.Rmd @@ -99,7 +99,7 @@ ggplot(data = heights, mapping = aes(x = height, y = income)) + `lm()` treats the variable(s) on the right-hand side of the formula as _explanatory variables_ that partially determine the value of the variable on the left-hand side of the formula, which is known as the _response variable_. In other words, it acts as if the _response variable_ is determined by a function of the _explanatory variables_. It then spots the linear function that best fits the data. -Linear models are straightforward to interpret. Incomes have a baseline mean of $`r coef(h)[1]`. Each one inch increase of height above zero is associated with an increase of $`r coef(h)[2]` in income. +Linear models are straightforward to interpret. Incomes have a baseline mean of $`r coef(h)[1]`$. Each one inch increase of height above zero is associated with an increase of $`r coef(h)[2]`$ in income. ```{r} summary(h) diff --git a/variation.Rmd b/variation.Rmd index b8ae842..6e5d4e3 100644 --- a/variation.Rmd +++ b/variation.Rmd @@ -26,7 +26,7 @@ Rectangular data provides a clear record of variation, but that doesn't mean it mat <- as.data.frame(matrix(morley$Speed + 299000, ncol = 10)) -knitr::kable(mat, caption = "*The speed of light is* the *universal constant, but variation obscures its value, here demonstrated by Albert Michelson in 1879. Michelson measured the speed of light 100 times and observed 30 different values (in km/sec).*", col.names = c("\\s", "\\s", "\\s", "\\s", "\\s", "\\s", "\\s", "\\s", "\\s", "\\s")) +knitr::kable(mat, caption = "*The speed of light is* the *universal constant, but variation obscures its value, here demonstrated by Albert Michelson in 1879. Michelson measured the speed of light 100 times and observed 30 different values (in km/sec).*", col.names = rep("", ncol(mat))) ```