Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/jhudsl/intro_to_r into main
Browse files Browse the repository at this point in the history
  • Loading branch information
jhudsl-robot committed Jan 10, 2023
2 parents 9b2097d + 3e78d5e commit b9acf13
Show file tree
Hide file tree
Showing 28 changed files with 68 additions and 68 deletions.
Binary file modified modules/Basic_R/Basic_R.pdf
Binary file not shown.
20 changes: 10 additions & 10 deletions modules/Basic_R/lab/Basic_R_Lab_Key.html
Original file line number Diff line number Diff line change
Expand Up @@ -291,16 +291,16 @@ <h1>Part 3</h1>
replace = TRUE
)
my_responses</code></pre>
<pre><code>## [1] &quot;Neutral&quot; &quot;Strongly Agree&quot; &quot;Neutral&quot;
## [4] &quot;Strongly Agree&quot; &quot;Disagree&quot; &quot;Disagree&quot;
## [7] &quot;Strongly Agree&quot; &quot;Agree&quot; &quot;Neutral&quot;
## [10] &quot;Strongly Agree&quot; &quot;Disagree&quot; &quot;Neutral&quot;
## [13] &quot;Disagree&quot; &quot;Neutral&quot; &quot;Strongly Agree&quot;
## [16] &quot;Neutral&quot; &quot;Neutral&quot; &quot;Disagree&quot;
## [19] &quot;Neutral&quot; &quot;Strongly Disagree&quot; &quot;Agree&quot;
## [22] &quot;Disagree&quot; &quot;Strongly Disagree&quot; &quot;Neutral&quot;
## [25] &quot;Agree&quot; &quot;Strongly Agree&quot; &quot;Disagree&quot;
## [28] &quot;Disagree&quot; &quot;Neutral&quot; &quot;Agree&quot;</code></pre>
<pre><code>## [1] &quot;Strongly Disagree&quot; &quot;Neutral&quot; &quot;Agree&quot;
## [4] &quot;Strongly Agree&quot; &quot;Strongly Disagree&quot; &quot;Strongly Disagree&quot;
## [7] &quot;Strongly Disagree&quot; &quot;Disagree&quot; &quot;Strongly Disagree&quot;
## [10] &quot;Strongly Disagree&quot; &quot;Strongly Agree&quot; &quot;Strongly Agree&quot;
## [13] &quot;Disagree&quot; &quot;Agree&quot; &quot;Strongly Agree&quot;
## [16] &quot;Strongly Disagree&quot; &quot;Agree&quot; &quot;Neutral&quot;
## [19] &quot;Disagree&quot; &quot;Strongly Disagree&quot; &quot;Strongly Agree&quot;
## [22] &quot;Neutral&quot; &quot;Strongly Agree&quot; &quot;Strongly Agree&quot;
## [25] &quot;Strongly Agree&quot; &quot;Disagree&quot; &quot;Neutral&quot;
## [28] &quot;Strongly Agree&quot; &quot;Strongly Disagree&quot; &quot;Strongly Disagree&quot;</code></pre>
<p><strong>Bonus / Extra practice</strong>: Let’s say you change your survey so participants can rank their response 1-10 (inclusive). Create a randomly sampled vector of 30 survey responses. (hint use <code>seq()</code> and <code>sample()</code> and set the replace argument to <code>TRUE</code>). Store the output as <code>my_responses_2</code>. Examine the data by typing the name in the Console using a function.</p>
<pre class="r"><code>my_responses_2 &lt;- sample(
x = seq(from = 1, to = 10),
Expand Down
2 changes: 1 addition & 1 deletion modules/Data_Classes/Data_Classes.html
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ <h1 data-config-title><!-- populated from slide_config.json --></h1>
<li>Double</li>
</ol>

</article></slide><slide class=""><hgroup><h2>Integer</h2></hgroup><article id="integer" class="small">
</article></slide><slide class=""><hgroup><h2>Integer</h2></hgroup><article class="small" id="integer">

<p><code>Integer</code> is a special subset of <code>numeric</code> that contains only <span style="color: red;">
whole numbers</span>.</p>
Expand Down
16 changes: 8 additions & 8 deletions modules/Data_Cleaning/Data_Cleaning.html
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ <h1 data-config-title><!-- populated from slide_config.json --></h1>
<li>The <code>lubridate</code> package is helpful for dates and times<br/>📃<a href='https://jhudatascience.org/intro_to_r/modules/cheatsheets/Day-4.pdf' title=''>Cheatsheet</a></li>
</ul>

</article></slide><slide class=""><hgroup><h2>Data Cleaning</h2></hgroup><article class="emphasized" id="data-cleaning">
</article></slide><slide class=""><hgroup><h2>Data Cleaning</h2></hgroup><article id="data-cleaning" class="emphasized">

<p>In general, data cleaning is a process of investigating your data for inaccuracies, or recoding it in a way that makes it more manageable.</p>

Expand All @@ -225,7 +225,7 @@ <h1 data-config-title><!-- populated from slide_config.json --></h1>
<li><code>Inf</code> and <code>-Inf</code> - Infinity, happens when you divide a positive number (or negative number) by 0.</li>
</ul>

</article></slide><slide class=""><hgroup><h2>Finding Missing data</h2></hgroup><article class="small" id="finding-missing-data">
</article></slide><slide class=""><hgroup><h2>Finding Missing data</h2></hgroup><article id="finding-missing-data" class="small">

<ul>
<li><code>is.na</code> - looks for <code>NAN</code> and <code>NA</code></li>
Expand All @@ -251,7 +251,7 @@ <h1 data-config-title><!-- populated from slide_config.json --></h1>

<pre >[1] FALSE FALSE TRUE</pre>

</article></slide><slide class=""><hgroup><h2>Useful checking functions</h2></hgroup><article class="small" id="useful-checking-functions">
</article></slide><slide class=""><hgroup><h2>Useful checking functions</h2></hgroup><article id="useful-checking-functions" class="small">

<ul>
<li><code>any</code> will be <code>TRUE</code> if ANY are true
Expand Down Expand Up @@ -538,7 +538,7 @@ <h1 data-config-title><!-- populated from slide_config.json --></h1>

<p><strong><code>filter()</code> removes missing values by default.</strong> Because R can’t tell for sure if an <code>NA</code> value meets the condition. To keep them need to add <code>is.na()</code> conditional.</p>

</article></slide><slide class=""><hgroup><h2>filter() and missing data</h2></hgroup><article class="codesmall" id="filter-and-missing-data-1">
</article></slide><slide class=""><hgroup><h2>filter() and missing data</h2></hgroup><article id="filter-and-missing-data-1" class="codesmall">

<pre class = 'prettyprint lang-r'>df</pre>

Expand Down Expand Up @@ -612,7 +612,7 @@ <h1 data-config-title><!-- populated from slide_config.json --></h1>
1 2 6
2 1 2</pre>

</article></slide><slide class=""><hgroup><h2>Drop <strong>columns</strong> with any missing values</h2></hgroup><article class="codesmall" id="drop-columns-with-any-missing-values">
</article></slide><slide class=""><hgroup><h2>Drop <strong>columns</strong> with any missing values</h2></hgroup><article id="drop-columns-with-any-missing-values" class="codesmall">

<p>Use the <code>miss_var_which()</code> function from <code>naniar</code></p>

Expand All @@ -633,7 +633,7 @@ <h1 data-config-title><!-- populated from slide_config.json --></h1>

<pre >[1] &quot;Dog&quot; &quot;Cat&quot;</pre>

</article></slide><slide class=""><hgroup><h2>Drop <strong>columns</strong> with any missing values</h2></hgroup><article class="codesmall" id="drop-columns-with-any-missing-values-1">
</article></slide><slide class=""><hgroup><h2>Drop <strong>columns</strong> with any missing values</h2></hgroup><article id="drop-columns-with-any-missing-values-1" class="codesmall">

<pre class = 'prettyprint lang-r'>df %&gt;% select(!miss_var_which(df))</pre>

Expand All @@ -647,7 +647,7 @@ <h1 data-config-title><!-- populated from slide_config.json --></h1>
5 5
6 6</pre>

</article></slide><slide class=""><hgroup><h2>Removing columns with threshold of percent missing row values</h2></hgroup><article class="codesmall" id="removing-columns-with-threshold-of-percent-missing-row-values">
</article></slide><slide class=""><hgroup><h2>Removing columns with threshold of percent missing row values</h2></hgroup><article id="removing-columns-with-threshold-of-percent-missing-row-values" class="codesmall">

<pre class = 'prettyprint lang-r'>is.na(df) %&gt;% head(n = 3)</pre>

Expand Down Expand Up @@ -712,7 +712,7 @@ <h1 data-config-title><!-- populated from slide_config.json --></h1>

<p>You might want to keep the <code>NA</code> values so that you know the original sample size.</p>

</article></slide><slide class=""><hgroup><h2>Word of caution</h2></hgroup><article class="codesmall" id="word-of-caution">
</article></slide><slide class=""><hgroup><h2>Word of caution</h2></hgroup><article id="word-of-caution" class="codesmall">

<p>Calculating percentages will give you a different result depending on your choice to include NA values.</p>

Expand Down
Binary file modified modules/Data_Cleaning/Data_Cleaning.pdf
Binary file not shown.
Binary file modified modules/Data_Input/Data_Input.pdf
Binary file not shown.
Binary file modified modules/Data_Output/Data_Output.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion modules/Data_Summarization/Data_Summarization.html
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ <h1 data-config-title><!-- populated from slide_config.json --></h1>
<pre > 0% 25% 50% 75% 100%
1.0 2.5 4.5 6.5 8.0 </pre>

</article></slide><slide class=""><hgroup><h2>Statistical summarization</h2></hgroup><article class="codesmall" id="statistical-summarization-2">
</article></slide><slide class=""><hgroup><h2>Statistical summarization</h2></hgroup><article id="statistical-summarization-2" class="codesmall">

<p>We will talk more about data types later, but you can only do summarization on numeric or logical types. Not characters.</p>

Expand Down
2 changes: 1 addition & 1 deletion modules/Data_Visualization/Data_Visualization.html

Large diffs are not rendered by default.

Binary file modified modules/Data_Visualization/Data_Visualization.pdf
Binary file not shown.
Binary file not shown.
Binary file modified modules/Factors/Factors.pdf
Binary file not shown.
12 changes: 6 additions & 6 deletions modules/Functions/Functions.html
Original file line number Diff line number Diff line change
Expand Up @@ -15814,7 +15814,7 @@ <h1 data-config-title><!-- populated from slide_config.json --></h1>
<li>Then list any arguments for the function</li>
</ul>

</article></slide><slide class=""><hgroup><h2>Applying functions with <code>across</code> from <code>dplyr</code>.</h2></hgroup><article id="applying-functions-with-across-from-dplyr." class="codesmall">
</article></slide><slide class=""><hgroup><h2>Applying functions with <code>across</code> from <code>dplyr</code>.</h2></hgroup><article class="codesmall" id="applying-functions-with-across-from-dplyr.">

<p>Combining with <code>summarize()</code>:</p>

Expand All @@ -15840,7 +15840,7 @@ <h1 data-config-title><!-- populated from slide_config.json --></h1>
# … with 23 more rows, and 2 more variables: IsOnlineSale &lt;dbl&gt;,
# WarrantyCost &lt;dbl&gt;</pre>

</article></slide><slide class=""><hgroup><h2>Applying functions with <code>across</code> from <code>dplyr</code>.</h2></hgroup><article id="applying-functions-with-across-from-dplyr.-1" class="codesmall">
</article></slide><slide class=""><hgroup><h2>Applying functions with <code>across</code> from <code>dplyr</code>.</h2></hgroup><article class="codesmall" id="applying-functions-with-across-from-dplyr.-1">

<p>Combining with <code>summarize()</code>:</p>

Expand All @@ -15866,7 +15866,7 @@ <h1 data-config-title><!-- populated from slide_config.json --></h1>
# … with 23 more rows, and 2 more variables: IsOnlineSale &lt;dbl&gt;,
# WarrantyCost &lt;dbl&gt;</pre>

</article></slide><slide class=""><hgroup><h2>Applying functions with <code>across</code> from <code>dplyr</code>.</h2></hgroup><article id="applying-functions-with-across-from-dplyr.-2" class="codesmall">
</article></slide><slide class=""><hgroup><h2>Applying functions with <code>across</code> from <code>dplyr</code>.</h2></hgroup><article class="codesmall" id="applying-functions-with-across-from-dplyr.-2">

<p>Using different <code>tidyselect()</code> options:</p>

Expand All @@ -15889,7 +15889,7 @@ <h1 data-config-title><!-- populated from slide_config.json --></h1>
10 HUMMER 2006 3 70809 11920
# … with 23 more rows</pre>

</article></slide><slide class=""><hgroup><h2>Applying functions with <code>across</code> from <code>dplyr</code>.</h2></hgroup><article id="applying-functions-with-across-from-dplyr.-3" class="codesmall">
</article></slide><slide class=""><hgroup><h2>Applying functions with <code>across</code> from <code>dplyr</code>.</h2></hgroup><article class="codesmall" id="applying-functions-with-across-from-dplyr.-3">

<p>Combining with <code>mutate()</code>:</p>

Expand All @@ -15912,7 +15912,7 @@ <h1 data-config-title><!-- populated from slide_config.json --></h1>
# … with 72,973 more rows, and 2 more variables: IsOnlineSale &lt;dbl&gt;,
# WarrantyCost &lt;dbl&gt;</pre>

</article></slide><slide class=""><hgroup><h2>Applying functions with <code>across</code> from <code>dplyr</code>.</h2></hgroup><article id="applying-functions-with-across-from-dplyr.-4" class="codesmall">
</article></slide><slide class=""><hgroup><h2>Applying functions with <code>across</code> from <code>dplyr</code>.</h2></hgroup><article class="codesmall" id="applying-functions-with-across-from-dplyr.-4">

<p>Combining with <code>mutate()</code>:</p>

Expand Down Expand Up @@ -15940,7 +15940,7 @@ <h1 data-config-title><!-- populated from slide_config.json --></h1>
# … with 72,973 more rows, and 2 more variables: IsOnlineSale &lt;chr&gt;,
# WarrantyCost &lt;chr&gt;</pre>

</article></slide><slide class=""><hgroup><h2>Applying functions with <code>across</code> from <code>dplyr</code>.</h2></hgroup><article id="applying-functions-with-across-from-dplyr.-5" class="codesmall">
</article></slide><slide class=""><hgroup><h2>Applying functions with <code>across</code> from <code>dplyr</code>.</h2></hgroup><article class="codesmall" id="applying-functions-with-across-from-dplyr.-5">

<p>Combining with <code>mutate()</code>:</p>

Expand Down
Binary file modified modules/Intro/Intro.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion modules/Subsetting_Data_in_R/index_withbase.html
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ <h1 data-config-title><!-- populated from slide_config.json --></h1>
{
UseMethod(&quot;filter&quot;)
}
&lt;bytecode: 0x55df73e00a88&gt;
&lt;bytecode: 0x559bc2fd8a88&gt;
&lt;environment: namespace:dplyr&gt;</pre>

</article></slide><slide class=""><hgroup><h2>Renaming Columns of a <code>data.frame</code>: dplyr</h2></hgroup><article id="renaming-columns-of-a-data.frame-dplyr-2">
Expand Down
Binary file modified modules/cheatsheets/Day-1.pdf
Binary file not shown.
Binary file modified modules/cheatsheets/Day-2.pdf
Binary file not shown.
Binary file modified modules/cheatsheets/Day-3.pdf
Binary file not shown.
Binary file modified modules/cheatsheets/Day-4.pdf
Binary file not shown.
Binary file modified modules/cheatsheets/Day-5.pdf
Binary file not shown.
Binary file modified modules/cheatsheets/Day-6.pdf
Binary file not shown.
Binary file modified modules/cheatsheets/Day-7.pdf
Binary file not shown.
Binary file modified modules/cheatsheets/Day-8.pdf
Binary file not shown.
Binary file modified modules/cheatsheets/Day-9.pdf
Binary file not shown.
Loading

0 comments on commit b9acf13

Please sign in to comment.