From d69eeff57e34a0b0e28720f96dc99ef247044e45 Mon Sep 17 00:00:00 2001 From: hadley Date: Thu, 11 Feb 2016 16:31:34 -0600 Subject: [PATCH] Ensure every chapter has a heading --- communicate.Rmd | 2 ++ databases.Rmd | 2 ++ model.Rmd | 5 ++++- program.Rmd | 2 ++ robust-code.Rmd | 2 +- science.Rmd | 2 ++ understand.Rmd | 2 ++ work.Rmd | 2 ++ 8 files changed, 17 insertions(+), 2 deletions(-) diff --git a/communicate.Rmd b/communicate.Rmd index 1e70684..3a6bb3e 100644 --- a/communicate.Rmd +++ b/communicate.Rmd @@ -3,4 +3,6 @@ layout: default title: Communicate your work --- +# Communicate your work + Reproducible, literate code is the data science equivalent of the Scientific Report (i.e, Intro, Methods and materials, Results, Discussion). diff --git a/databases.Rmd b/databases.Rmd index 8011808..19c1015 100644 --- a/databases.Rmd +++ b/databases.Rmd @@ -3,6 +3,8 @@ layout: default title: Databases --- +# Databases + ### Two-table verbs Each two-table verb has a straightforward SQL equivalent: diff --git a/model.Rmd b/model.Rmd index 32cf91c..e9763ef 100644 --- a/model.Rmd +++ b/model.Rmd @@ -3,6 +3,8 @@ layout: default title: Model --- +# Model + A model is a function that summarizes how the values of one variable vary in response to the values of other variables. Models play a large role in hypothesis testing and prediction, but for the moment you should think of models just like you think of statistics. A statistic summarizes a *distribution* in a way that is easy to understand; and a model summarizes *covariation* in a way that is easy to understand. In other words, a model is just another way to describe data. This chapter will explain how to build useful models with R. @@ -298,6 +300,7 @@ ns() # natural splines ``` ```{r} +library(splines) tidy(lm(income ~ ns(education, knots = c(10, 17)), data = heights)) tidy(lm(income ~ ns(education, df = 4), data = heights)) ``` @@ -314,7 +317,7 @@ ggplot(data = heights, mapping = aes(x= education, y = income)) + ```{r} gam(income ~ s(education), data = heights) -ggplot(data = heights, mapping = aes(x= education, y = income)) + +ggplot(data = heights, mapping = aes(x = education, y = income)) + geom_point() + geom_smooth(method = gam, formula = y ~ s(x)) ``` diff --git a/program.Rmd b/program.Rmd index 62563db..070ad92 100644 --- a/program.Rmd +++ b/program.Rmd @@ -3,4 +3,6 @@ layout: default title: Save time by programming --- +# Programming + Computer-human communication matters. diff --git a/robust-code.Rmd b/robust-code.Rmd index c50a71f..b9ee8c1 100644 --- a/robust-code.Rmd +++ b/robust-code.Rmd @@ -7,7 +7,7 @@ title: Robust code library(magrittr) ``` -## Robust code +# Robust code (This is an advanced topic. You shouldn't worry too much about it when you first start writing functions. Instead you should focus on getting a function that works right for the easiest 80% of the problem. Then in time, you'll learn how to get to 99% with minimal extra effort. The defaults in this book should steer you in the right direction: we avoid teaching you functions with major suprises.) diff --git a/science.Rmd b/science.Rmd index 816bdb8..e73002b 100644 --- a/science.Rmd +++ b/science.Rmd @@ -3,4 +3,6 @@ layout: default title: Do science with data --- +# Do science with data + The scientific method guides data science. Data science solves known problems with the scientific method. diff --git a/understand.Rmd b/understand.Rmd index d233976..0132b24 100644 --- a/understand.Rmd +++ b/understand.Rmd @@ -3,4 +3,6 @@ layout: default title: Understand your data --- +# Understand your data + Data poses a cognitive problem; Data comprehension is a skill. diff --git a/work.Rmd b/work.Rmd index 9fb6141..a9e4072 100644 --- a/work.Rmd +++ b/work.Rmd @@ -3,4 +3,6 @@ layout: default title: Work with your data --- +# Work with your data + With data, the relationships between values matter as much as the values themselves. Tidy data encodes those relationships.