Skip to content

Commit

Permalink
Updated slide formatting for data wrangling day
Browse files Browse the repository at this point in the history
  • Loading branch information
TWiedRW committed Jan 18, 2024
1 parent 34a6f95 commit f41972d
Show file tree
Hide file tree
Showing 44 changed files with 242 additions and 625 deletions.
211 changes: 22 additions & 189 deletions docs/r-format/code/99-YourTurnSolutions.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>

<meta charset="utf-8">
<meta name="generator" content="quarto-1.4.489">
<meta name="generator" content="quarto-1.3.353">

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">

Expand All @@ -22,7 +22,7 @@
}
/* CSS for syntax highlighting */
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { line-height: 1.25; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
Expand Down Expand Up @@ -79,13 +79,7 @@
"collapse-after": 3,
"panel-placement": "end",
"type": "overlay",
"limit": 50,
"keyboard-shortcut": [
"f",
"/",
"s"
],
"show-item-context": false,
"limit": 20,
"language": {
"search-no-results-text": "No results",
"search-matching-documents-text": "matching documents",
Expand All @@ -95,8 +89,7 @@
"search-more-matches-text": "more matches in this document",
"search-clear-button-title": "Clear",
"search-detached-cancel-button-title": "Cancel",
"search-submit-button-title": "Submit",
"search-label": "Search"
"search-submit-button-title": "Submit"
}
}</script>

Expand All @@ -108,9 +101,9 @@

<div id="quarto-search-results"></div>
<header id="quarto-header" class="headroom fixed-top">
<nav class="navbar navbar-expand-lg " data-bs-theme="dark">
<nav class="navbar navbar-expand-lg navbar-dark ">
<div class="navbar-container container-fluid">
<div class="navbar-brand-container mx-auto">
<div class="navbar-brand-container">
<a class="navbar-brand" href="../../index.html">
<span class="navbar-title">UNL R Workshops</span>
</a>
Expand All @@ -122,29 +115,29 @@
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav navbar-nav-scroll me-auto">
<li class="nav-item">
<a class="nav-link" href="../../index.html">
<span class="menu-text">Home</span></a>
<a class="nav-link" href="../../index.html" rel="" target="">
<span class="menu-text">Home</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="../../r-intro/index.html">
<span class="menu-text">Introduction to R</span></a>
<a class="nav-link" href="../../r-intro/index.html" rel="" target="">
<span class="menu-text">Introduction to R</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="../../r-graphics/index.html">
<span class="menu-text">Graphics with ggplot2</span></a>
<a class="nav-link" href="../../r-graphics/index.html" rel="" target="">
<span class="menu-text">Graphics with ggplot2</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="../../r-format/index.html">
<span class="menu-text">Data Wrangling</span></a>
<a class="nav-link" href="../../r-format/index.html" rel="" target="">
<span class="menu-text">Data Wrangling</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="../../r-modeling/index.html">
<span class="menu-text">Modeling</span></a>
<a class="nav-link" href="../../r-modeling/index.html" rel="" target="">
<span class="menu-text">Modeling</span></a>
</li>
</ul>
</div> <!-- /navcollapse -->
<div class="quarto-navbar-tools">
<div class="quarto-navbar-tools ms-auto">
</div>
</div> <!-- /navcollapse -->
</div> <!-- /container-fluid -->
</nav>
</header>
Expand Down Expand Up @@ -177,18 +170,16 @@ <h1 class="title">Your Turn Solutions</h1>



<div class="quarto-title-meta column-page-left">
<div class="quarto-title-meta">




</div>



</header>


<section id="reading-files" class="level2">
<h2 class="anchored" data-anchor-id="reading-files">Reading files</h2>
<section id="have-a-look-at-the-parameters-of-read_csv-to-solve-the-following-problems" class="level4">
Expand Down Expand Up @@ -606,9 +597,10 @@ <h4 class="anchored" data-anchor-id="load-the-lahman-package-into-your-r-session
// clear code selection
e.clearSelection();
});
function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) {
function tippyHover(el, contentFn) {
const config = {
allowHTML: true,
content: contentFn,
maxWidth: 500,
delay: 100,
arrow: false,
Expand All @@ -618,17 +610,8 @@ <h4 class="anchored" data-anchor-id="load-the-lahman-package-into-your-r-session
interactive: true,
interactiveBorder: 10,
theme: 'quarto',
placement: 'bottom-start',
placement: 'bottom-start'
};
if (contentFn) {
config.content = contentFn;
}
if (onTriggerFn) {
config.onTrigger = onTriggerFn;
}
if (onUntriggerFn) {
config.onUntrigger = onUntriggerFn;
}
window.tippy(el, config);
}
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
Expand All @@ -642,128 +625,6 @@ <h4 class="anchored" data-anchor-id="load-the-lahman-package-into-your-r-session
const note = window.document.getElementById(id);
return note.innerHTML;
});
}
const xrefs = window.document.querySelectorAll('a.quarto-xref');
const processXRef = (id, note) => {
// Strip column container classes
const stripColumnClz = (el) => {
el.classList.remove("page-full", "page-columns");
if (el.children) {
for (const child of el.children) {
stripColumnClz(child);
}
}
}
stripColumnClz(note)
const typesetMath = (el) => {
if (window.MathJax) {
// MathJax Typeset
window.MathJax.typeset([el]);
} else if (window.katex) {
// KaTeX Render
var mathElements = el.getElementsByClassName("math");
var macros = [];
for (var i = 0; i < mathElements.length; i++) {
var texText = mathElements[i].firstChild;
if (mathElements[i].tagName == "SPAN") {
window.katex.render(texText.data, mathElements[i], {
displayMode: mathElements[i].classList.contains('display'),
throwOnError: false,
macros: macros,
fleqn: false
});
}
}
}
}
if (id === null || id.startsWith('sec-')) {
// Special case sections, only their first couple elements
const container = document.createElement("div");
if (note.children && note.children.length > 2) {
for (let i = 0; i < 2; i++) {
container.appendChild(note.children[i].cloneNode(true));
}
typesetMath(container);
return container.innerHTML
} else {
typesetMath(note);
return note.innerHTML;
}
} else {
// Remove any anchor links if they are present
const anchorLink = note.querySelector('a.anchorjs-link');
if (anchorLink) {
anchorLink.remove();
}
typesetMath(note);
return note.innerHTML;
}
}
for (var i=0; i<xrefs.length; i++) {
const xref = xrefs[i];
tippyHover(xref, undefined, function(instance) {
instance.disable();
let url = xref.getAttribute('href');
let hash = undefined;
if (url.startsWith('#')) {
hash = url;
} else {
try { hash = new URL(url).hash; } catch {}
}
if (hash) {
const id = hash.replace(/^#\/?/, "");
const note = window.document.getElementById(id);
if (note !== null) {
try {
const html = processXRef(id, note.cloneNode(true));
instance.setContent(html);
} finally {
instance.enable();
instance.show();
}
} else {
// See if we can fetch this
fetch(url.split('#')[0])
.then(res => res.text())
.then(html => {
const parser = new DOMParser();
const htmlDoc = parser.parseFromString(html, "text/html");
const note = htmlDoc.getElementById(id);
if (note !== null) {
const html = processXRef(id, note);
instance.setContent(html);
}
}).finally(() => {
instance.enable();
instance.show();
});
}
} else {
// See if we can fetch a full url (with no hash to target)
// This is a special case and we should probably do some content thinning / targeting
fetch(url)
.then(res => res.text())
.then(html => {
const parser = new DOMParser();
const htmlDoc = parser.parseFromString(html, "text/html");
const note = htmlDoc.querySelector('main.content');
if (note !== null) {
// This should only happen for chapter cross references
// (since there is no id in the URL)
// remove the first header
if (note.children.length > 0 && note.children[0].tagName === "HEADER") {
note.children[0].remove();
}
const html = processXRef(null, note);
instance.setContent(html);
}
}).finally(() => {
instance.enable();
instance.show();
});
}
}, function(instance) {
});
}
let selectedAnnoteEl;
const selectorForAnnotation = ( cell, annotation) => {
Expand Down Expand Up @@ -806,7 +667,6 @@ <h4 class="anchored" data-anchor-id="load-the-lahman-package-into-your-r-session
}
div.style.top = top - 2 + "px";
div.style.height = height + 4 + "px";
div.style.left = 0;
let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
if (gutterDiv === null) {
gutterDiv = window.document.createElement("div");
Expand All @@ -832,32 +692,6 @@ <h4 class="anchored" data-anchor-id="load-the-lahman-package-into-your-r-session
});
selectedAnnoteEl = undefined;
};
// Handle positioning of the toggle
window.addEventListener(
"resize",
throttle(() => {
elRect = undefined;
if (selectedAnnoteEl) {
selectCodeLines(selectedAnnoteEl);
}
}, 10)
);
function throttle(fn, ms) {
let throttle = false;
let timer;
return (...args) => {
if(!throttle) { // first call gets through
fn.apply(this, args);
throttle = true;
} else { // all the others get throttled
if(timer) clearTimeout(timer); // cancel #2
timer = setTimeout(() => {
fn.apply(this, args);
timer = throttle = false;
}, ms);
}
};
}
// Attach click handler to the DT
const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
for (const annoteDlNode of annoteDls) {
Expand Down Expand Up @@ -921,5 +755,4 @@ <h4 class="anchored" data-anchor-id="load-the-lahman-package-into-your-r-session




</body></html>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit f41972d

Please sign in to comment.