Skip to content

Commit 76b12f0

Browse files
authored
Merge pull request #303 from JasonJWilliamsNY/patch-for-299
Patch for #299
2 parents 5d7055b + b456d85 commit 76b12f0

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

episodes/01-r-basics.Rmd

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -446,10 +446,13 @@ human_chr_number * 2
446446

447447
## Exercise: Compute the golden ratio
448448

449+
The [golden ratio](https://en.wikipedia.org/wiki/Golden_ratio) is a famous
450+
mathematical constant associated with beauty, architecture, and [art](https://www.mos.org/leonardo/activities/golden-ratio.html).
451+
449452
One approximation of the golden ratio (φ) can be found by taking the sum of 1
450-
and the square root of 5, and dividing by 2 as in the example above. Compute
453+
and the square root of 5, and dividing that sum by 2, as in the example above. Compute
451454
the golden ratio to 3 digits of precision using the `sqrt()` and `round()`
452-
functions. Hint: remember the `round()` function can take 2 arguments.
455+
functions. Hint: the `round()` function can take 2 arguments.
453456

454457
::::::::::::::: solution
455458

@@ -459,7 +462,8 @@ functions. Hint: remember the `round()` function can take 2 arguments.
459462
round((1 + sqrt(5)) / 2, digits = 3)
460463
```
461464

462-
Notice that you can place one function inside of another.
465+
Notice that you can place one function inside of another, and that you can use
466+
the 'digits' argument to return the desired precision.
463467

464468

465469

@@ -507,6 +511,7 @@ Let's create a few more vectors to play around with:
507511
```{r, purl=FALSE}
508512
# Some interesting human SNPs
509513
# while accuracy is important, typos in the data won't hurt you here
514+
# feel free to copy and paste
510515
511516
snps <- c("rs53576", "rs1815739", "rs6152", "rs1799971")
512517
snp_chromosomes <- c("3", "11", "X", "6")
@@ -736,8 +741,8 @@ c("ACTN3","APOA5") %in% snp_genes
736741
## Tip: What's the difference between the `%in% and the `==` operators?
737742

738743
The `%in%` operator is used to test if the elements of a vector are
739-
present in another vector. In the example above, if both "ACTN3" and "APOA5" are in
740-
the vector `snp_genes`, then R will return `TRUE TRUE` since they are both present.
744+
present in another vector. In the example above, if both "ACTN3" and "APOA5" are in
745+
the vector `snp_genes`, then R will return `TRUE TRUE` since they are both present.
741746
If "ACTN3" is but "APOA5" is not in `snp_genes`, then R will return `TRUE FALSE`. The `==` operator
742747
is used to test if two vectors are exactly equal. For example, if you wanted to know if the vector `c(1, 2, 3)`
743748
was equal to the vector `c(1, 2, 3)`, you could use the `==` operator. One trick people sometimes

0 commit comments

Comments
 (0)