From d4cf3707596110de5f5dc1f0ece8842e7ffb7bbd Mon Sep 17 00:00:00 2001 From: beacurious <32319878+beacurious@users.noreply.github.com> Date: Mon, 16 Nov 2020 14:29:20 +1100 Subject: [PATCH] fix typos in exercise 5.4.3 lines 548 and 559 --- transform.Rmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/transform.Rmd b/transform.Rmd index 80d7d174..81e7f622 100644 --- a/transform.Rmd +++ b/transform.Rmd @@ -545,7 +545,7 @@ select(flights, vars) ``` However there is a problem with the previous code. The name `vars` could refer to a column named `vars` in `flights` or a different variable named `vars`. -What th code does will depend on whether or not `vars` is a column in `flights`. +What the code does will depend on whether or not `vars` is a column in `flights`. If `vars` was a column in `flights`, then that code would only select the `vars` column. For example: ```{r} @@ -556,7 +556,7 @@ select(flights, vars) flights <- select(flights, -vars) ``` -However, `vars` is not a column in `flights`, as is the case, then `select` will use the value the value of the , and select those columns. +However, if `vars` is not a column in `flights`, as is the case, then `select` will use the values from the character vector `vars` and select those columns. If it has the same name or to ensure that it will not conflict with the names of the columns in the data frame, use the `!!!` (bang-bang-bang) operator. ```{r} select(flights, !!!vars)