Skip to content

Commit

Permalink
Fused some paragraphs and fixed spelling.
Browse files Browse the repository at this point in the history
  • Loading branch information
abner-hb committed Apr 30, 2024
1 parent 0ed4770 commit ea42571
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 17 deletions.
6 changes: 2 additions & 4 deletions 01_the_r_environment.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,14 @@ You can also find many powerful tools to fit statistical models
models)
- Classification and Clustering
- Sample Size and Power Calculations
- Multivariable analysis (Factor Analysis, Principal Component Analysis, Structural Equations Modeling, ...)
- Multivariable analysis (e.g., Factor Analysis, Principal Component Analysis, and Structural Equations Modeling)

Even better, new tools become available in **R** all the time. As with other open source programming languages, everyone can examine and contribute to **R**'s code. Users constantly publish their own code "packages" (ready-to-use tools), which expand **R**'s base capabilities. As of March 2019, users have contributed over 13,700 packages to Comprehensive **R** Archive Network (CRAN)., many of which perform complex statistical routines that are not (and may never be) available in other statistical software systems.

You can choose your own way of using **R**. In Windows, there are several ways to use **R**. The standard **R** graphical unit interface (GUI) allows you to point and click to do many basic tasks. Another GUI is [**R** Commander](https://socialsciences.mcmaster.ca/jfox/Misc/Rcmdr/), developed by
John Fox at McMaster University. **R** Commander displays the underlying **R** code for each analysis to help the user learn the programming language. [Tinn-**R**](http://sourceforge.net/projects/tinn-r/) is another GUI from Jose Claudio Faria.

These GUIs are friendly and easy to grasp if you're a beginner. But to use all of **R**'s capabilities you will need to do more than point and click.

A more complete way of using **R** is through an integrated development environment (IDE), which, in short, helps you code. The most popular IDE for **R** is [**R**Studio](https://www.posit.com), which organizes the
These GUIs are friendly and easy to grasp if you're a beginner. But to use all of **R**'s capabilities you will need to do more than point and click. A more complete way of using **R** is through an integrated development environment (IDE), which, in short, helps you code. The most popular IDE for **R** is [**R**Studio](https://www.posit.com), which organizes the
user's screen into panes that display scripts, objects, graphics, and
the **R** console.

Expand Down
6 changes: 2 additions & 4 deletions 02_getting_started_with_r.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ solve_quadratic(a = 1, b = -1, c = -3)

Our function can have as many arguments as we like. It is enough to add their names, separated by commas, in the parentheses that follow the function. When the function runs, **R** will replace each argument name in the function body with the corresponding value that we supply. If we don't supply a value, **R** will replace the argument name with the argument's default value (if we defined one).

We can also user our functions to create other functions. Imagine that we want to multiply the solutions to our equation by an arbitrary value (maybe because we want to convert the units of $x$ to something else). And let's pretend that, by default, we want to double the solutions. We can write another function that first calls `solve_quadratic()` and then multiplies the result by our arbitrary number.
We can also use our functions to create other functions. Imagine that we want to multiply the solutions to our equation by an arbitrary value (maybe because we want to convert the units of $x$ to something else). And let's pretend that, by default, we want to double the solutions. We can write another function that first calls `solve_quadratic()` and then multiplies the result by our arbitrary number.

```{r}
multiply_solutions = function(a, b, c, multiplier = 2) {
Expand Down Expand Up @@ -708,6 +708,4 @@ readxl::read_xlsx("fake_data_file.xlsx")

## Exercise

Let's try to practice all of the basic features of **R** that you just learned.

Write a function that can simulate the roll of a pair of six-sided dice (let's call them red and blue) an arbitrary number of times. This function should return a vector with the values of the red die that were strictly larger than the corresponding values of the blue die. Hint: to simulate rolling a die, you can use the function `sample()`.
Let's try to practice all of the basic features of **R** that you just learned. Write a function that can simulate the roll of a pair of six-sided dice (let's call them red and blue) an arbitrary number of times. This function should return a vector with the values of the red die that were strictly larger than the corresponding values of the blue die. Hint: to simulate rolling a die, you can use the function `sample()`.
5 changes: 2 additions & 3 deletions docs/01_the_r_environment.html
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,11 @@ <h2 data-number="1.1" class="anchored" data-anchor-id="why-becoming-a-user"><spa
<li>Random and Mixed Effects Models (aka hierarchical models, aka multilevel models)</li>
<li>Classification and Clustering</li>
<li>Sample Size and Power Calculations</li>
<li>Multivariable analysis (Factor Analysis, Principal Component Analysis, Structural Equations Modeling, …)</li>
<li>Multivariable analysis (e.g., Factor Analysis, Principal Component Analysis, and Structural Equations Modeling)</li>
</ul>
<p>Even better, new tools become available in <strong>R</strong> all the time. As with other open source programming languages, everyone can examine and contribute to <strong>R</strong>’s code. Users constantly publish their own code “packages” (ready-to-use tools), which expand <strong>R</strong>’s base capabilities. As of March 2019, users have contributed over 13,700 packages to Comprehensive <strong>R</strong> Archive Network (CRAN)., many of which perform complex statistical routines that are not (and may never be) available in other statistical software systems.</p>
<p>You can choose your own way of using <strong>R</strong>. In Windows, there are several ways to use <strong>R</strong>. The standard <strong>R</strong> graphical unit interface (GUI) allows you to point and click to do many basic tasks. Another GUI is <a href="https://socialsciences.mcmaster.ca/jfox/Misc/Rcmdr/"><strong>R</strong> Commander</a>, developed by John Fox at McMaster University. <strong>R</strong> Commander displays the underlying <strong>R</strong> code for each analysis to help the user learn the programming language. <a href="http://sourceforge.net/projects/tinn-r/">Tinn-<strong>R</strong></a> is another GUI from Jose Claudio Faria.</p>
<p>These GUIs are friendly and easy to grasp if you’re a beginner. But to use all of <strong>R</strong>’s capabilities you will need to do more than point and click.</p>
<p>A more complete way of using <strong>R</strong> is through an integrated development environment (IDE), which, in short, helps you code. The most popular IDE for <strong>R</strong> is <a href="https://www.posit.com"><strong>R</strong>Studio</a>, which organizes the user’s screen into panes that display scripts, objects, graphics, and the <strong>R</strong> console.</p>
<p>These GUIs are friendly and easy to grasp if you’re a beginner. But to use all of <strong>R</strong>’s capabilities you will need to do more than point and click. A more complete way of using <strong>R</strong> is through an integrated development environment (IDE), which, in short, helps you code. The most popular IDE for <strong>R</strong> is <a href="https://www.posit.com"><strong>R</strong>Studio</a>, which organizes the user’s screen into panes that display scripts, objects, graphics, and the <strong>R</strong> console.</p>
<p>In these notes, we will use <strong>R</strong>Studio a lot. The goal is for you to start taking full advantage of <strong>R</strong>’s capabilities.</p>
<!--
Expand Down
5 changes: 2 additions & 3 deletions docs/02_getting_started_with_r.html
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ <h2 data-number="2.8" class="anchored" data-anchor-id="writing-our-own-functions
</div>
<p><code>return()</code> does not need to be the last line of the function. It can appear anywhere else and the function will still yield whatever <code>return()</code> contains.</p>
<p>Our function can have as many arguments as we like. It is enough to add their names, separated by commas, in the parentheses that follow the function. When the function runs, <strong>R</strong> will replace each argument name in the function body with the corresponding value that we supply. If we don’t supply a value, <strong>R</strong> will replace the argument name with the argument’s default value (if we defined one).</p>
<p>We can also user our functions to create other functions. Imagine that we want to multiply the solutions to our equation by an arbitrary value (maybe because we want to convert the units of <span class="math inline">\(x\)</span> to something else). And let’s pretend that, by default, we want to double the solutions. We can write another function that first calls <code>solve_quadratic()</code> and then multiplies the result by our arbitrary number.</p>
<p>We can also use our functions to create other functions. Imagine that we want to multiply the solutions to our equation by an arbitrary value (maybe because we want to convert the units of <span class="math inline">\(x\)</span> to something else). And let’s pretend that, by default, we want to double the solutions. We can write another function that first calls <code>solve_quadratic()</code> and then multiplies the result by our arbitrary number.</p>
<div class="cell">
<div class="sourceCode cell-code" id="cb147"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb147-1"><a href="#cb147-1" aria-hidden="true" tabindex="-1"></a>multiply_solutions <span class="ot">=</span> <span class="cf">function</span>(a, b, c, <span class="at">multiplier =</span> <span class="dv">2</span>) {</span>
<span id="cb147-2"><a href="#cb147-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">solve_quadratic</span>(a, b, c) <span class="sc">*</span> multiplier</span>
Expand Down Expand Up @@ -996,8 +996,7 @@ <h2 data-number="2.9" class="anchored" data-anchor-id="acquiring-external-packag
</section>
<section id="exercise" class="level2" data-number="2.10">
<h2 data-number="2.10" class="anchored" data-anchor-id="exercise"><span class="header-section-number">2.10</span> Exercise</h2>
<p>Let’s try to practice all of the basic features of <strong>R</strong> that you just learned.</p>
<p>Write a function that can simulate the roll of a pair of six-sided dice (let’s call them red and blue) an arbitrary number of times. This function should return a vector with the values of the red die that were strictly larger than the corresponding values of the blue die. Hint: to simulate rolling a die, you can use the function <code>sample()</code>.</p>
<p>Let’s try to practice all of the basic features of <strong>R</strong> that you just learned. Write a function that can simulate the roll of a pair of six-sided dice (let’s call them red and blue) an arbitrary number of times. This function should return a vector with the values of the red die that were strictly larger than the corresponding values of the blue die. Hint: to simulate rolling a die, you can use the function <code>sample()</code>.</p>


</section>
Expand Down
Loading

0 comments on commit ea42571

Please # to comment.