Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
dKvale committed Dec 12, 2023
1 parent 6f2999a commit b86c15b
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ arrange(torg, date)

> Icky...It looks like there are duplicate rows in the data. That seems to happen a lot. Since the temp value always appears to be the same for the duplicate row, I think it is safe to say the duplicate should be removed.
If you are 100% sure your data should not have duplicate rows in it, you can use the function `distinct( )` to keep only one row from each of the groups of duplicates. In the end, every row will be a distinct and unique row compared to ALL the others in the table.
<br>

If you are 100% sure your data should not have duplicate rows in it, you can use the function `distinct( )` to keep only one row from each of the groups of duplicates. In the end, every row will be a distinct and unique row compared to ALL others in the table.


```{r distinct}
Expand Down
45 changes: 23 additions & 22 deletions content/page/exercise/day5/05-2-date-mischief-and-data-joins.html
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ <h3>Step 1</h3>
<blockquote>
<p>Icky…It looks like there are duplicate rows in the data. That seems to happen a lot. Since the temp value always appears to be the same for the duplicate row, I think it is safe to say the duplicate should be removed.</p>
</blockquote>
<p>If you are 100% sure your data should not have duplicate rows in it, you can use the function <code>distinct( )</code> to keep only one row from each of the groups of duplicates. In the end, every row will be a distinct and unique row compared to ALL the others in the table.</p>
<p><br></p>
<p>If you are 100% sure your data should not have duplicate rows in it, you can use the function <code>distinct( )</code> to keep only one row from each of the groups of duplicates. In the end, every row will be a distinct and unique row compared to ALL others in the table.</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb5-1"><a href="#cb5-1" tabindex="-1"></a>torg <span class="ot">&lt;-</span> <span class="fu">distinct</span>(torg)</span></code></pre></div>
<blockquote>
<p>How many rows does <em>torg</em> have now?</p>
Expand Down Expand Up @@ -216,23 +217,23 @@ <h3><i class="fas fa-cookie-bite" style="color: gray;"></i> Which island?</h3>
</div>
<div id="make-it-a-date" class="section level3 unnumbered quiz">
<h3><i class="fas fa-cookie-bite" style="color: gray;"></i> Make it a Date</h3>
<ul class="nav nav-pills" id="myTab2483" role="tablist" style="margin-top: 18px;">
<ul class="nav nav-pills" id="myTab4841" role="tablist" style="margin-top: 18px;">
<li class="nav-item active">
<a class="nav-link" id="description2483-tab" data-toggle="tab" href="#description2483" role="tab" aria-controls="description2483" aria-selected="true">Description</a>
<a class="nav-link" id="description4841-tab" data-toggle="tab" href="#description4841" role="tab" aria-controls="description4841" aria-selected="true">Description</a>
</li>
<li class="nav-item">
<a class="nav-link" id="showhint2483-tab" data-toggle="tab" href="#showhint2483" role="tab" aria-controls="showhint2483" aria-selected="false">Show hint</a>
<a class="nav-link" id="showhint4841-tab" data-toggle="tab" href="#showhint4841" role="tab" aria-controls="showhint4841" aria-selected="false">Show hint</a>
</li>
<li class="nav-item">
<a class="nav-link" id="showcode2483-tab" data-toggle="tab" href="#showcode2483" role="tab" aria-controls="showcode2483" aria-selected="false">Show code</a>
<a class="nav-link" id="showcode4841-tab" data-toggle="tab" href="#showcode4841" role="tab" aria-controls="showcode4841" aria-selected="false">Show code</a>
</li>
</ul>
<div id="myTabContent" class="well tab-content" style="background-color: white;">
<div id="description2483" class="tab-pane fade active in" role="tabpanel" aria-labelledby="description2483-tab">
<div id="description4841" class="tab-pane fade active in" role="tabpanel" aria-labelledby="description4841-tab">
<p><b> Use <code>mutate( )</code> to convert the <em>date</em> column to a Date object in each of the data sets.</b></p>
<p><br></p>
</div>
<div id="showhint2483" class="tab-pane fade" role="tabpanel" aria-labelledby="showhint2483-tab">
<div id="showhint4841" class="tab-pane fade" role="tabpanel" aria-labelledby="showhint4841-tab">
<pre class="sourceCode r">

biscoe <- biscoe %>%
Expand All @@ -245,7 +246,7 @@ <h3><i class="fas fa-cookie-bite" style="color: gray;"></i> Make it a Date</h3>

</pre>
</div>
<div id="showcode2483" class="tab-pane fade" role="tabpanel" aria-labelledby="showcode2483-tab">
<div id="showcode4841" class="tab-pane fade" role="tabpanel" aria-labelledby="showcode4841-tab">
<pre class="sourceCode r">
biscoe <- biscoe %>%
mutate(date = mdy(date))
Expand Down Expand Up @@ -306,23 +307,23 @@ <h2>More data exploartion</h2>
<p>Both data frames have an <strong>island</strong> column and a <strong>date</strong> column, but with different names. What operation do we want to use? Which join type is most appropriate here? Remember that when combining data frames, column names are important and are case-sensitive. We want the resulting data frame to have the same number of rows as the <em>penguins_raw</em> data frame.</p>
<div id="table-join" class="section level3 unnumbered quiz">
<h3><i class="fas fa-cookie-bite" style="color: gray;"></i> Table join</h3>
<ul class="nav nav-pills" id="myTab2575" role="tablist" style="margin-top: 18px;">
<ul class="nav nav-pills" id="myTab1519" role="tablist" style="margin-top: 18px;">
<li class="nav-item active">
<a class="nav-link" id="description2575-tab" data-toggle="tab" href="#description2575" role="tab" aria-controls="description2575" aria-selected="true">Description</a>
<a class="nav-link" id="description1519-tab" data-toggle="tab" href="#description1519" role="tab" aria-controls="description1519" aria-selected="true">Description</a>
</li>
<li class="nav-item">
<a class="nav-link" id="showhint2575-tab" data-toggle="tab" href="#showhint2575" role="tab" aria-controls="showhint2575" aria-selected="false">Show hint</a>
<a class="nav-link" id="showhint1519-tab" data-toggle="tab" href="#showhint1519" role="tab" aria-controls="showhint1519" aria-selected="false">Show hint</a>
</li>
<li class="nav-item">
<a class="nav-link" id="showcode2575-tab" data-toggle="tab" href="#showcode2575" role="tab" aria-controls="showcode2575" aria-selected="false">Show code</a>
<a class="nav-link" id="showcode1519-tab" data-toggle="tab" href="#showcode1519" role="tab" aria-controls="showcode1519" aria-selected="false">Show code</a>
</li>
</ul>
<div id="myTabContent" class="well tab-content" style="background-color: white;">
<div id="description2575" class="tab-pane fade active in" role="tabpanel" aria-labelledby="description2575-tab">
<div id="description1519" class="tab-pane fade active in" role="tabpanel" aria-labelledby="description1519-tab">
<p><b> Use a <code>****_join( )</code> function to combine the columns of the two data sets so the result has the same number of rows as <em>penguins_raw</em>.</b></p>
<p><br></p>
</div>
<div id="showhint2575" class="tab-pane fade" role="tabpanel" aria-labelledby="showhint2575-tab">
<div id="showhint1519" class="tab-pane fade" role="tabpanel" aria-labelledby="showhint1519-tab">
<pre class="sourceCode r">
penguin_temps <- left_join(penguins_raw, temps,
by = c("Island" = "_______" ,
Expand All @@ -332,7 +333,7 @@ <h3><i class="fas fa-cookie-bite" style="color: gray;"></i> Table join</h3>

</pre>
</div>
<div id="showcode2575" class="tab-pane fade" role="tabpanel" aria-labelledby="showcode2575-tab">
<div id="showcode1519" class="tab-pane fade" role="tabpanel" aria-labelledby="showcode1519-tab">
<pre class="sourceCode r">
penguin_temps <- left_join(penguins_raw, temps,
by = c("Island" = "island",
Expand Down Expand Up @@ -373,23 +374,23 @@ <h2>Plots</h2>
<p><img src="/R-camp-penguins/page/exercise/day5/05-2-date-mischief-and-data-joins_files/figure-html/plots-1.png" width="73%" /></p>
<div id="isotope-plots" class="section level3 unnumbered quiz">
<h3><i class="fas fa-cookie-bite" style="color: gray;"></i> Isotope plots</h3>
<ul class="nav nav-pills" id="myTab192" role="tablist" style="margin-top: 18px;">
<ul class="nav nav-pills" id="myTab2294" role="tablist" style="margin-top: 18px;">
<li class="nav-item active">
<a class="nav-link" id="description192-tab" data-toggle="tab" href="#description192" role="tab" aria-controls="description192" aria-selected="true">Description</a>
<a class="nav-link" id="description2294-tab" data-toggle="tab" href="#description2294" role="tab" aria-controls="description2294" aria-selected="true">Description</a>
</li>
<li class="nav-item">
<a class="nav-link" id="showhint192-tab" data-toggle="tab" href="#showhint192" role="tab" aria-controls="showhint192" aria-selected="false">Show hint</a>
<a class="nav-link" id="showhint2294-tab" data-toggle="tab" href="#showhint2294" role="tab" aria-controls="showhint2294" aria-selected="false">Show hint</a>
</li>
<li class="nav-item">
<a class="nav-link" id="showcode192-tab" data-toggle="tab" href="#showcode192" role="tab" aria-controls="showcode192" aria-selected="false">Show code</a>
<a class="nav-link" id="showcode2294-tab" data-toggle="tab" href="#showcode2294" role="tab" aria-controls="showcode2294" aria-selected="false">Show code</a>
</li>
</ul>
<div id="myTabContent" class="well tab-content" style="background-color: white;">
<div id="description192" class="tab-pane fade active in" role="tabpanel" aria-labelledby="description192-tab">
<div id="description2294" class="tab-pane fade active in" role="tabpanel" aria-labelledby="description2294-tab">
<p><b> Make 2 plots. One comparing temperature to Delta 15 N, and one comparing temperature to Delta 13 C. Assign the data from each island to its own color.</b></p>
<p><br></p>
</div>
<div id="showhint192" class="tab-pane fade" role="tabpanel" aria-labelledby="showhint192-tab">
<div id="showhint2294" class="tab-pane fade" role="tabpanel" aria-labelledby="showhint2294-tab">
<pre class="sourceCode r">
# Delta 15 plot
ggplot(penguin_temps,
Expand All @@ -402,7 +403,7 @@ <h3><i class="fas fa-cookie-bite" style="color: gray;"></i> Isotope plots</h3>

</pre>
</div>
<div id="showcode192" class="tab-pane fade" role="tabpanel" aria-labelledby="showcode192-tab">
<div id="showcode2294" class="tab-pane fade" role="tabpanel" aria-labelledby="showcode2294-tab">
<pre class="sourceCode r">
# Delta 15 plot
ggplot(penguin_temps,
Expand Down
47 changes: 24 additions & 23 deletions public/page/exercise/day5/05-2-date-mischief-and-data-joins.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"headline": "Date mischief",
"description" : "Getting started Create a new R script. Save it as soon as you make it and give it a good name like 5-2_exercise.",
"inLanguage" : "en",
"wordCount": 1424 ,
"wordCount": 1423 ,
"datePublished" : "0001-01-01T00:00:00",
"dateModified" : "0001-01-01T00:00:00",
"image" : "https:\/\/tidy-mn.github.io\/R-camp-penguins\/images\/penguins_circle1.png",
Expand Down Expand Up @@ -399,7 +399,8 @@ <h3>Step 1</h3>
<blockquote>
<p>Icky…It looks like there are duplicate rows in the data. That seems to happen a lot. Since the temp value always appears to be the same for the duplicate row, I think it is safe to say the duplicate should be removed.</p>
</blockquote>
<p>If you are 100% sure your data should not have duplicate rows in it, you can use the function <code>distinct( )</code> to keep only one row from each of the groups of duplicates. In the end, every row will be a distinct and unique row compared to ALL the others in the table.</p>
<p><br></p>
<p>If you are 100% sure your data should not have duplicate rows in it, you can use the function <code>distinct( )</code> to keep only one row from each of the groups of duplicates. In the end, every row will be a distinct and unique row compared to ALL others in the table.</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb5-1"><a href="#cb5-1" tabindex="-1"></a>torg <span class="ot">&lt;-</span> <span class="fu">distinct</span>(torg)</span></code></pre></div>
<blockquote>
<p>How many rows does <em>torg</em> have now?</p>
Expand Down Expand Up @@ -488,23 +489,23 @@ <h3><i class="fas fa-cookie-bite" style="color: gray;"></i> Which island?</h3>
</div>
<div id="make-it-a-date" class="section level3 unnumbered quiz">
<h3><i class="fas fa-cookie-bite" style="color: gray;"></i> Make it a Date</h3>
<ul class="nav nav-pills" id="myTab2483" role="tablist" style="margin-top: 18px;">
<ul class="nav nav-pills" id="myTab4841" role="tablist" style="margin-top: 18px;">
<li class="nav-item active">
<a class="nav-link" id="description2483-tab" data-toggle="tab" href="#description2483" role="tab" aria-controls="description2483" aria-selected="true">Description</a>
<a class="nav-link" id="description4841-tab" data-toggle="tab" href="#description4841" role="tab" aria-controls="description4841" aria-selected="true">Description</a>
</li>
<li class="nav-item">
<a class="nav-link" id="showhint2483-tab" data-toggle="tab" href="#showhint2483" role="tab" aria-controls="showhint2483" aria-selected="false">Show hint</a>
<a class="nav-link" id="showhint4841-tab" data-toggle="tab" href="#showhint4841" role="tab" aria-controls="showhint4841" aria-selected="false">Show hint</a>
</li>
<li class="nav-item">
<a class="nav-link" id="showcode2483-tab" data-toggle="tab" href="#showcode2483" role="tab" aria-controls="showcode2483" aria-selected="false">Show code</a>
<a class="nav-link" id="showcode4841-tab" data-toggle="tab" href="#showcode4841" role="tab" aria-controls="showcode4841" aria-selected="false">Show code</a>
</li>
</ul>
<div id="myTabContent" class="well tab-content" style="background-color: white;">
<div id="description2483" class="tab-pane fade active in" role="tabpanel" aria-labelledby="description2483-tab">
<div id="description4841" class="tab-pane fade active in" role="tabpanel" aria-labelledby="description4841-tab">
<p><b> Use <code>mutate( )</code> to convert the <em>date</em> column to a Date object in each of the data sets.</b></p>
<p><br></p>
</div>
<div id="showhint2483" class="tab-pane fade" role="tabpanel" aria-labelledby="showhint2483-tab">
<div id="showhint4841" class="tab-pane fade" role="tabpanel" aria-labelledby="showhint4841-tab">
<pre class="sourceCode r">

biscoe <- biscoe %>%
Expand All @@ -517,7 +518,7 @@ <h3><i class="fas fa-cookie-bite" style="color: gray;"></i> Make it a Date</h3>

</pre>
</div>
<div id="showcode2483" class="tab-pane fade" role="tabpanel" aria-labelledby="showcode2483-tab">
<div id="showcode4841" class="tab-pane fade" role="tabpanel" aria-labelledby="showcode4841-tab">
<pre class="sourceCode r">
biscoe <- biscoe %>%
mutate(date = mdy(date))
Expand Down Expand Up @@ -578,23 +579,23 @@ <h2>More data exploartion</h2>
<p>Both data frames have an <strong>island</strong> column and a <strong>date</strong> column, but with different names. What operation do we want to use? Which join type is most appropriate here? Remember that when combining data frames, column names are important and are case-sensitive. We want the resulting data frame to have the same number of rows as the <em>penguins_raw</em> data frame.</p>
<div id="table-join" class="section level3 unnumbered quiz">
<h3><i class="fas fa-cookie-bite" style="color: gray;"></i> Table join</h3>
<ul class="nav nav-pills" id="myTab2575" role="tablist" style="margin-top: 18px;">
<ul class="nav nav-pills" id="myTab1519" role="tablist" style="margin-top: 18px;">
<li class="nav-item active">
<a class="nav-link" id="description2575-tab" data-toggle="tab" href="#description2575" role="tab" aria-controls="description2575" aria-selected="true">Description</a>
<a class="nav-link" id="description1519-tab" data-toggle="tab" href="#description1519" role="tab" aria-controls="description1519" aria-selected="true">Description</a>
</li>
<li class="nav-item">
<a class="nav-link" id="showhint2575-tab" data-toggle="tab" href="#showhint2575" role="tab" aria-controls="showhint2575" aria-selected="false">Show hint</a>
<a class="nav-link" id="showhint1519-tab" data-toggle="tab" href="#showhint1519" role="tab" aria-controls="showhint1519" aria-selected="false">Show hint</a>
</li>
<li class="nav-item">
<a class="nav-link" id="showcode2575-tab" data-toggle="tab" href="#showcode2575" role="tab" aria-controls="showcode2575" aria-selected="false">Show code</a>
<a class="nav-link" id="showcode1519-tab" data-toggle="tab" href="#showcode1519" role="tab" aria-controls="showcode1519" aria-selected="false">Show code</a>
</li>
</ul>
<div id="myTabContent" class="well tab-content" style="background-color: white;">
<div id="description2575" class="tab-pane fade active in" role="tabpanel" aria-labelledby="description2575-tab">
<div id="description1519" class="tab-pane fade active in" role="tabpanel" aria-labelledby="description1519-tab">
<p><b> Use a <code>****_join( )</code> function to combine the columns of the two data sets so the result has the same number of rows as <em>penguins_raw</em>.</b></p>
<p><br></p>
</div>
<div id="showhint2575" class="tab-pane fade" role="tabpanel" aria-labelledby="showhint2575-tab">
<div id="showhint1519" class="tab-pane fade" role="tabpanel" aria-labelledby="showhint1519-tab">
<pre class="sourceCode r">
penguin_temps <- left_join(penguins_raw, temps,
by = c("Island" = "_______" ,
Expand All @@ -604,7 +605,7 @@ <h3><i class="fas fa-cookie-bite" style="color: gray;"></i> Table join</h3>

</pre>
</div>
<div id="showcode2575" class="tab-pane fade" role="tabpanel" aria-labelledby="showcode2575-tab">
<div id="showcode1519" class="tab-pane fade" role="tabpanel" aria-labelledby="showcode1519-tab">
<pre class="sourceCode r">
penguin_temps <- left_join(penguins_raw, temps,
by = c("Island" = "island",
Expand Down Expand Up @@ -645,23 +646,23 @@ <h2>Plots</h2>
<p><img src="/R-camp-penguins/page/exercise/day5/05-2-date-mischief-and-data-joins_files/figure-html/plots-1.png" width="73%" /></p>
<div id="isotope-plots" class="section level3 unnumbered quiz">
<h3><i class="fas fa-cookie-bite" style="color: gray;"></i> Isotope plots</h3>
<ul class="nav nav-pills" id="myTab192" role="tablist" style="margin-top: 18px;">
<ul class="nav nav-pills" id="myTab2294" role="tablist" style="margin-top: 18px;">
<li class="nav-item active">
<a class="nav-link" id="description192-tab" data-toggle="tab" href="#description192" role="tab" aria-controls="description192" aria-selected="true">Description</a>
<a class="nav-link" id="description2294-tab" data-toggle="tab" href="#description2294" role="tab" aria-controls="description2294" aria-selected="true">Description</a>
</li>
<li class="nav-item">
<a class="nav-link" id="showhint192-tab" data-toggle="tab" href="#showhint192" role="tab" aria-controls="showhint192" aria-selected="false">Show hint</a>
<a class="nav-link" id="showhint2294-tab" data-toggle="tab" href="#showhint2294" role="tab" aria-controls="showhint2294" aria-selected="false">Show hint</a>
</li>
<li class="nav-item">
<a class="nav-link" id="showcode192-tab" data-toggle="tab" href="#showcode192" role="tab" aria-controls="showcode192" aria-selected="false">Show code</a>
<a class="nav-link" id="showcode2294-tab" data-toggle="tab" href="#showcode2294" role="tab" aria-controls="showcode2294" aria-selected="false">Show code</a>
</li>
</ul>
<div id="myTabContent" class="well tab-content" style="background-color: white;">
<div id="description192" class="tab-pane fade active in" role="tabpanel" aria-labelledby="description192-tab">
<div id="description2294" class="tab-pane fade active in" role="tabpanel" aria-labelledby="description2294-tab">
<p><b> Make 2 plots. One comparing temperature to Delta 15 N, and one comparing temperature to Delta 13 C. Assign the data from each island to its own color.</b></p>
<p><br></p>
</div>
<div id="showhint192" class="tab-pane fade" role="tabpanel" aria-labelledby="showhint192-tab">
<div id="showhint2294" class="tab-pane fade" role="tabpanel" aria-labelledby="showhint2294-tab">
<pre class="sourceCode r">
# Delta 15 plot
ggplot(penguin_temps,
Expand All @@ -674,7 +675,7 @@ <h3><i class="fas fa-cookie-bite" style="color: gray;"></i> Isotope plots</h3>

</pre>
</div>
<div id="showcode192" class="tab-pane fade" role="tabpanel" aria-labelledby="showcode192-tab">
<div id="showcode2294" class="tab-pane fade" role="tabpanel" aria-labelledby="showcode2294-tab">
<pre class="sourceCode r">
# Delta 15 plot
ggplot(penguin_temps,
Expand Down

0 comments on commit b86c15b

Please sign in to comment.