 My name is John Little, and this is a workshop that was requested by the DataFest group. DataFest is a contest about analyzing data that is sponsored by the Duke's step-side department, and my Center for Data and Visualization Sciences is always happy to participate in that. This particular workshop that they requested is about making slides out of R, and there's a great package called Sharingan that we're going to talk about today, which is a way to make slides out of R Markdown, and R Markdown is a way to do literate coding where you have your pros and your code chunks integrated into your analysis. So there's a lot of jargon there, and I want to break it down. Anybody who's been working with R for a while, some of this will feel a little bit redundant, but it's worth it to double check. However, let me just mention that if you're brand new to R and R Studio, and this is the first time that you've been on one of my workshops, let me just point out the R Fund site, which is a sub-branded site for my department, my Center for Data and Visualization Sciences. And what you'll find there is a whole series of modules on different things that you can do in R. And for example, I mentioned that Windows machines sometimes need to be configured with Git, so if you click on Find Out More, there's a link to a previously recorded session, and there's always code and slides if they're available. But it's the historical information here that's useful. If you're brand new and recommend this first module, quick start with R. There are a series of shorter videos, 20 minutes or less, sometimes just five minutes, that cover important concepts. So quick start, deploy for data wrangling. There's a whole series of different little sub-videos here. So R Studio Projects, which I just mentioned, would be right there. R Studio, the IDE, tidyverse, joining and merging, pivoting, all of those things. If I cover something too fast, just know that you can refer to those videos later. But going back to that GitHub link, what we're going to cover is we're going to cover Markdown, what it is and why it's useful. And then we're going to start by producing our very first sharing in slides. And finally, I want to point out that there are some, there's a slide deck on just documentation. Because what I've found is that sharing in is actually pretty easy to get started with. But slides often, they take on sort of the kind of a heightened importance for the person who's authoring them. Because usually we look at slides very closely in terms of the style and presentation. And so you probably want to go beyond the default style and presentation of sharing in. And what I found is that documentation is kind of all over the place. So I tried to pull together the important parts into this one document. Now, let me just briefly explain a little bit about GitHub, which is the site that this repository is hosted on. There's really just three files here. There's the 00 markdown.rd that stands for our markdown. There's the 01 get started sharing in r&d. And there's the 99 documentation links to r&d. Okay, so the cool thing about our markdown is that you can, you can put your code and your pros into an R Markdown document. And then up to the very top and we'll look at this in just a minute. There's a line that can identify what kind of report you want to produce. So do you want to produce slides or do you want to produce a dashboard or PDF document or whatever. So I used our markdown in the first case in this first document to render a dot mb dot html document that's a notebook document that you could send anybody like you would send a PDF document. But the difference being that because in this case it's an HTML document. It really has the ability to be interactive on like a PDF document. I don't want to really go on too long about these different report styles but the code is the dot r&d so that has a rendered output. This dot r&d has a rendered output. And while you can use our markdown to generate PDF documents for the case of slides. It's often easiest if you just open the slide deck, which is, it's rendered into an HTML document so open the slide deck and either Firefox or Chrome, and then just print it. And rather than printing it to your printer or print it to a PDF file. The advantage there is that this HTML file is not self contained this one is but this one is not. So you need some extra, we can talk about that but you need some extra supporting files that are easy to pull together. I just didn't do it. The easier step is to print it out as a PDF document. So in this case if I'm hosting it on GitHub, as I am. I can just click on the PDF document. And you'll see that the slides will be rendered. Here and a person could scroll through me. Okay, so clicking back. There is the same thing for the documentation, there's an HTML slide deck. And there's a PDF rendered version. Both. In this case they did not both get produced I'll just hammer that home they did not both get produced from the R&D, although typically the R&D is how you produce all of your derivatives just slides are special. All right so we're going to start with 00R markdown. So, one more time if you haven't done this, click on the green button, click on the download zip, unzip that and then open the RStudio project. That will take you or should take you to in RStudio project that looks a little bit like this I'm just to make sure that I've got everything clean I'm going to click restart. And of course I'm going to open this 00R mark, 00 markdown. Probably worth pointing out at this point that markdown is a general concept it was developed by these two guys, John Gruber and Aaron Schwartz back in 2004. Although it's called markdown it actually is a markup language so for anybody who's looked at the source of a web page, the source that makes a web page work generally, minimally is something called HTML hypertext markup language. And these are all ways to provide structure to a document. In the case of markdown markup languages are often hard to read you often need something like a browser to render that into something easier to read. The goal of markdown was to make a markup language that is appealing to human readers. So this is an example of that. What it means by appealing to human readers is that you can read this markup and basically get a sense of what's happening here. Right. You don't have to have a special viewer, just to read the content you may need a special viewer to get the style that I want to impose but not to just read the content. So that's what markdown is. Now, the guy who developed the sharing package that we're going to use today his name is ui z I believe is his last name. He actually created our markdown there's no single definitive version of markdown. And there's minor minor differences between markdown and our markdown. For the most part they work almost exactly the same but we are in fact using our markdown, because we're in this case in our studio. Okay, so markdown basically consists of kind of like three parts. There's a little header at the top. And importantly it has a line like this all this header can get more elaborate but it always has. There's actually one footnote to that but we don't have to go into that there's it always has one output variable to identify what is the rendered output that you want. In this case it says HTML which is a good way to start if you haven't done this before. Anytime you want to start a markdown the easiest way to start is to go to new file or notebook. And that produces another markdown document that that displays really what I want you to know a markdown document has a header, and then it has pros and code chunks. The code chunks are the analysis the pros is going to explain the analysis. You can have multiple code chunks. In this case it turns out that the pros is explaining our markdown so it's a little self referential. But it's useful to know every time you open up one of these notebooks, you're going to get information about how markdown works. So here's an example of a code chunk and some very basic our code. If I wanted to execute that I could click on the green button that actually is identified right there. If I wanted another code chunk as it says right here, I could just put my cursor right there inside. I can place it on Windows control I can I get another code chunk, or I can put in another one I can use the mouse. Have one more code chunk I can put more elaborate code in each one of these things, but I'm not going to do that. Just put some comments in there. And then typically what someone will do. You'll notice that there is some other markdown going on here there's a link. That's a bold word. If I wanted this word to be italics, I could wrap it in underscores. And then when I click preview. It's going to ask me for a file name so I'm just going to say. Oh, world. It's important to have a dot R and the extension. And are should render that. It just rendered it into the dot MD dot HTML extension. And you can see that down in the viewer and you can see that the title is rendered as a header one and you can see a link. And you can see, oops, I was wrong about that I said that that run was bold is in fact, astros to underscore single ones make things italic, whereas doubles make it full. I'm going to just click preview again so you can see the difference or bold there's italics. And then you can, of course, integrate your code. If I didn't want my code to show up maybe I have a technical audience maybe my goal is to have a technical audience and let them to see the code. Or maybe my goal is an executive audience where I don't want them to see the code I just want them to see the output. There's all kinds of configuration options that you can get to in a code chunk by clicking on this gear right here. Anyways, I would change it to show output only. And I could run the whole document. There's only one code chunk that matters. But preview it one more time and you'll see that that code chunk just the other two code chunks are still there they check just one comment. I'm going to turn those apart off. I could do it globally, etc. That's what our markdown essentially lets you do. It's an example of what's called literate coding. Right is this idea that all of what you need to produce your output is in a single file, and your pros is intermingled with your code and your analysis. And that goes towards reproducibility. If you keep it all in one spot and come back to it after setting it down for six months. You don't have to wonder oh how am I going to copy and paste this what program did I use for this part of the analysis and what program did I use for the visualization. And how did I exactly produce the output and then I copied it somewhere and then I pasted into Microsoft Word. All of those copy and paste tips end up being essentially barriers to reproducibility. So that's another reason why people use our markdown and literate coding. There's another example of literate coding aside from our markdown you may have heard of Jupiter notebooks. Jupiter actually stands for three coding languages Julia, Python, and our so technically you could be multi-lingual in a Jupyter notebook. You can be multi-lingual in our markdown as well. So there's some repeat there. I'm going back to my 00R markdown. I covered that part. And I covered that part right getting started you just have to click on our notebook. Now. Oh, this is important to point out in case you don't have the latest version or one of the later versions of our studio. If you upgrade there's a nice feature in 1.4 and above, which allows you to have rather than what feels like this old 1970s style of word processing. I guess I should probably say 1980s style because almost none of us were were processing in the 70s, including me. But if you wanted a visual editor from our studio version 1.4 there's a new icon over here and there's an option from the menu. It says switch to visual editor. So I can press that button and indeed I could then, you know, do the editing like where I'll used to in a super modern context. And it works quite well. I wanted to turn that word into a link. I could add a link. And then it's a link. Now. That's very nice by myself find that I kind of prefer the other way once I've gotten very used to it. So no recommendation there if you prefer the visual editing upgrade and and it will work very well it'll work the way you're expected to accept and this is maybe but important to know that under the current version of sharing, which is the package we're going to use today for slides, visual editing doesn't work. And that's probably because you can do some very specific things with markdown and the visual editor is relatively new and the markdown package is a little bit older. Obviously two things will merge. But if you wanted to undo the visual editing to turn that off and back to the traditional editing, you just click that icon. Okay, so it's good to know about that. We talked about this right up in the very top line three. This is going to produce an HTML notebook when I click preview for most of the other markdown options. It's going to change from a preview button to a yet button so you'll hear people talk about instead of saying rendering they'll say I needed the document. Here's an example of some of the kinds of documents that you can get right. HTML notebooks we just saw HTML documents they're roughly the same, but the sort of the differences that HTML notebook is kind of for development whereas HTML document is really kind of more towards the final production. And why is that an HTML document will, every time you knit it, it will spawn a protected unique our process and start from line one and go all the way to the bottom, whereas, as opposed to HTML notebooks that are more for development, you can run codes out of sequence you can run code chunks out of sequence. You can skip things, and you don't have to run the whole document in order to render it. So I myself tend to mostly work in our markdown notebooks. Until I decided that I want to make something else be it a word file or a PDF or a dashboard slides that we're going to do today. So a useful exercise that we might try before the end of the day is that you could take this 00 underscore our markdown document and turn this into a series of slides. As we get towards the end you'll be able to do that. It will require a little more editing in the case of each slide, just like it would if you wrote your outline in Microsoft Word, and then decided to turn that word document into a Microsoft PowerPoint. You know, because of the nature of slides where precision and placement kind of really matters, you're going to have to do a little bit of tweaking, but you can do it, you can definitely do it and so you can imagine that if you have code chunks interspersed in your document. You're going to be able to keep everything together. We talked about the YAML header that's up at the top. We talked about rendering reports and just a minute just a quick comment about help. If you've never worked with our markdown before from the help menu, you can go to markdown quick reference. And this is a really nice handy guide of the ways that you can mark up your text. I'm not going to cover the details right here it's very short, barely a page long. But that's not enough for you remember that the Hello World document that I created actually has a link to the R Markdown website. In addition to those two sources, if you rather than scroll down to this markdown, but you hover over cheat sheets, there are even two more R Markdown cheat sheets. And so the more you work with Markdown. You'll find that you're using some of those features like, like footnoting that it automatically every footnote red it's going to, it's going to increment each footnote by one things of that nature. So they take a little bit of work, but not much and you'll find that as you use them they become quite intuitive. Nonetheless, every time you use a command line kind of tool. If you don't remember it it's handy to know where those reference kind so. Okay, so what I want to do next is I want to start by making in our sharing and slide deck. But before I do that. I think what I want to do is I want to show you. Here's a slide deck that I'm actually going to be. This is a sharing and slide deck. I'm going to actually be just using this tomorrow morning for a different presentation on doing. But the reason why I want to show it to you is because I've been working with sharing and for a couple years and as I mentioned earlier to do the easy stuff is really quite simple and very intuitive. But it's taken me a little while to find the exact format of how I want to present a slide deck right what are the fonts that I want to use things of that nature. And this has evolved into this slide deck where you can have a whole image on the right and then have it. I'm going to go to the left for the next slide and things like that. Some of this takes a little bit of doing. And I so I want to show you this may be the maybe even if you don't like the fonts I'm using. You might recognize that you'll end up developing your own slide style and sharing and certainly supports that. But we're not going to get too far into that today I'll try and point you to all of those things that all of those techniques are in the 99 documentation links. I'm not going to go into the files. But what we're going to do is we're going to just go back to files. And if you want to work along with me that's fine. You can open up and oh one get started sharing and R&D file. And I have mine right here. All the way up to the top. And you'll notice right off the bat that my YAML header is much more elaborate than what I had a moment ago. Now, I want to go through this but before I do, if you have installed sharing it. Let me go back to GitHub for just a second. Down in the read me file, the very last line, you could use that to install sharing and it would also try to reinstall tiny versus it wouldn't. It wouldn't harm anything if you already have tiny versus tall. It won't harm anything if you don't have time to install but this is how you would install sharing again if you don't already have it going back to our studio of course you could always click on packages install. Next they are sharing them, and there are two packages we'll talk about sharing them later. But you could install that. Once you get that installed. The easiest way to get started with to get this rather elaborate YAML header is to do it this way. Go to file, new file, scroll down this time instead of our notebooks scroll down to our markdown. To this wizard choose from template I'm going to do this twice because I know it goes a little bit fast. And when you get from to from template scroll down until you find the option that says ninja presentation and over on the right. It tells you that's coming from the sharing in library. Right. If I click on that, it's going to open up a very similar version of this document and the nice thing about this document is. It's actually the directions on how to use sharing. So all you have to do, you know, come right back to us to show you this again, but all I have to do to make this work is click knit. And when I click knit, the R markdown is going to render. And there's a slide that I modified of UES sharing in documentation. It's largely the same. Okay, so just real quickly I'll show you that one more time so it doesn't get lost new file. From template ninja presentation. And this time I will click okay so you can see what happens. Just throw up a new file. And all you would have to do is click knit. And you would get very similar documentation I modified it only ever so slightly. I think I'm going to do this but I don't know I don't know that I'm going to recommend that you do this right off the bat but one of the nice things about sharing. Just don't follow me at this point, but just so you can see everything on one screen is that sharing in comes with this tool called the infinite moon reader, which you can largely ignore what that means. I'm going to click restart just to make sure everything stays clean. It puts a thing into my add it's all the way down at the bottom in my case, and I'm going to click infinite moon reader. What infinite moon reader does is it allows me to render my slides in this viewer in real time, rather than having to click knit every single time. So that's going to be useful for our demonstration. You may be perfectly comfortable with and fine with clicking clicking it every time and there's nothing wrong with that. But for this demonstration is just going to be a little bit easier if you can see what I'm doing in real time. And what I mean by real time is if I decide to change the name from sharing and demo to sharing and Demonstration, and I click save. I'll give the renderer a minute to to reconfigure and it's updated the slides. And so that as I move my slide deck. I can create new slides. Right. So this stuff right up here you can you can pretty much guess what's going to happen there. And then what really makes sharing and work is that those two lines right there, output to sharing and moon reader, and that's how you render these slides. So what we've got here is a mark down. A bit of code that says header one right, a single hashtag is a header one I wanted to make a second level hashtag I could do header to or third level and you can see over on the right that it's changing size and rendering different ways depending on how I limit it. I also have some class information up at the top. This is allowing me to center the text. Not only actually vertically but well I always get those confused but it doesn't matter center has my has my text center, whereas middle has my slide center from top to bottom right so if I took out one of those classes, and I resaved it. This slide should reconfigure and now you can see it's top justified so those. That's one thing that sharing and allows you to do is it allows you to create classes of slide behavior. And when we get into the documentation. You'll see how that works but again, if you had done that new docked out that new mark down from template shared in presentation you would get all this information in the documentation and so you could see how it works in real time. So here's my first slide. And then, if I go to the second slide, you can see that there's another feature, the ability to have background images. I have a text on top of this if I want to one of the things that's really striking to me about this is that there's this little code chunk right here. This is usually at the very top, I actually moved it down one just like it's stuck with the text slide. But let me move this slide up to the top so you can see how you can, you create new slides by just just adding three new dashes like you see a line 25 or line 14 or line 37. And I wanted a new slide between nifty and and this image. I could just use my cursor and create a new slide and they can header size to new slide. And then I could do things like say, Sharon Sharon slides super nifty. And I might make that bold. And it would be really helpful to have a whole bunch of ready made text but I'm just going to copy this over and over again. And then I might do something like say, fruit, apple, great. And orange, right and I've made a little bullet list. And in the spirit of our markdown, I might want to do something more than that. Right, maybe I want to have something on the left hand side and something on the right hand side. And this is in these slides to go farther down, but I'm just going to show you. There's a class called pull left poll dash left. And you anything that goes inside a poll dash left is going to be pulled to the left. So I'm going to paste my text in there. And to make it pretty I'm going to kind of separate out some of the stuff, and then I might also want to have me hit save so it re renders. It might make sense to you that there's also a class called poll dash right. And so I'll put all right over here. And sometimes you have to kind of finesse it a little bit like this seems to be higher than that I don't really like that. I'm just going to put in a break, which you can do in a number of ways. I think I'm going to try this before so we'll see if that works. Yeah, that didn't work so ignore that. One of the nice things about Markdown is you can actually use HTML markup in Markdown document. So in HTML markup there is a tag called BR break. And you'll notice that I could have several of those and I can use that to really kind of finesse the exact location of the text. My goal here was to have it have them be roughly in the same spot. And they're close. They're not as close as I want. I can pull that up. No, not up down anyway, I could fool with this for a long time and eventually I'll get it right. The point that I wanted to show you was there these these classes called pull back and pull right. And it maybe is not a surprise but just so you can see it you can do other things like you can center the text for right justify the text. Either one of those cases. And that that's essentially how you compose slides in sharing. Right now I said that this thing is usually the top so I want to go ahead and move this to the top. And then I'll explain why a little bit more about what is here. I'm going to put it really right up here. Right there. I'll move back up to the top and we render the slides. The reason why this is always up at the top is because of this little code chunk here that does not display. And I'll just be honest with you. I don't even know what it does. I never really looked into it. I assume that it's important for how web pages get rendered because sharing and slides get rendered as if they were web pages, right. The viewer for sharing and slides is a web browser. But I have from time to time left it out and it didn't hurt anything. Just sort of my policy rather than looking up to see what exactly what it does was just to leave it in. It seems to be fine. There's some other. Markdown that you see right here. This is the way to separate out the slide from the speaker notes. Right. So these are speakers. And the way you would get speaker notes to peer is that there are shortcut keys for sharing and slide presentation. So if you have a sharing inside presentation up in in Firefox or Chrome or whatever, you can hit your question mark. And it'll give you the keystroke tips, but I happen to know that if you hit the letter P. It gives you the speaker note view right so my current slide, my speaker notes, and my next slide. So I could actually clone this and have one slide that's being presented and speaker notes and all of the nice features of speaker notes could happen at the same time. I'm going to change that back to its presentation. And let me just double check where how we are on time 710, we started at 630. Okay, so I did a little bit of on the spot sort of documentation but just remember that the stuff that I just showed you is basically embedded throughout this whole document. There's another sharing and slide that's centered in middle has a header one and a header three. Here is what's called an inverse slide. Right so if you want to have like sections among your slides. You could use the class inverse, and that's going to change everything if I take that away, and we read the slides you'll see how it changes back to normal. Return that to where it was. And we render that slide. And you can see that I put some text here inside of what looks like a code chunk but it does not it's not an R code chunk because it doesn't have the code designation, and that just makes it a mono spaced box that you can use to demonstrate or show some code that you're not planning on running or that you need to appear in mono space. You could do that and I do that rather frequently. Here's a slide that reminds you how to install sharing. There's a slide. Oh, there's a nice feature here. It's demonstrated here. Notice that we went from three dashes. And there are several two dash options in our space by single dashes right. What does all this mean the single dashes are for bulletin items. And the two dashes are to allow you to incrementally reveal your slides every time you click on right. So you can see that they're this is all part of one slide from here. This is two of the three dashes at line 81, and I was just able to incrementally reveal that in my presentation mode. In my case with my arrow keys, but I think you can click on it to. So that's a nice feature. Another nice feature that's worth pointing out if you can skip the. This is kind of an inside joke or Easter egg by the developer. This is a friend of his name is Carl. The point really of this slide aside from he wanted to highlight Carl's face larger than the image usually is, is to show some of the background image features that you can use. And you'll notice that because he set class to inverse his header size one, which is appearing at the bottom, because it's inverse it also shows up as font is white. And that's how you can use the basics of markdown to the best of your advantage. Now this is important. He calls this a ninja presentation. And he might be points out that sharing in slides are built on this library called remark.js. So there's really very little between difference between sharing in and remark, they basically work the same. But most there's a lot of documentation and remark that he does not recreate the main differences are things like infinite moon reader and the ability to run within our studio. So I kind of largely ignore remark. But it's nice to know and he recommends right here that you should probably read the remark wiki that is the documentation about configuring slide shows and slide classes and some of those things classes like we just mentioned right class center class bomb. Oops, sorry. That is documented at this wiki. And it's sometimes easier to it's probably worth it says right here you should read through it at least once, probably true, I will admit that I didn't read through it at all until I've been using sharing in for a year or two but when I finally got around to reading it. I found it helpful. Just scan it just to see what are the things that it can do that I might want to do with my slide deck. Okay, here's another this is the same picture as before you'll just notice that this is the actual picture using the background size cover to cover up the whole slide and you'll notice that it's. It's, there's more depth of field to this picture, or there's a wider frame, because of the one previous. You can see some features to make it zoom in. So that's one way you can more features that you can use with your with your images. Here's another inverse slide that and from this point forward, he's mostly just talking about how you can use sharing. There's a particular slide who's talking about the differences between the two. But here's something in this next slide that many of you will find useful. If you are, particularly if you're going to data fast or you're coming to this from staff side you may need to display. Here's one of the other ones, la tech formulas that are marked up in la tech. The way to do that is to surround your formula, your la tech formula in double dollar. Excuse me double dollar science, and that will display it nicely in the middle of the page. If you were to render your la tech formula in single dollar science, you could render your formula in line with the rest of the text. There's some limitations there that he mentions. And a lot of what goes on forward I'm not going to do this much longer, because I want to get to some of the other stuff that's useful. You can display code. Here's how you can display plots. So you could do a ggplot there if you're familiar with ggplot, here's how you can display tables. If you're not used to tables. I like, I like the GT package a little bit better. T tables. And we will display that with the GT function from the GT library, and let's go ahead and see if I can get it to render that. There you go. So a little too much code up there at the top, which happens from time to time. The easiest thing to do is just to change that down to show output only. And I'm just going to put my cursor in here and hit save again. And the moon reader will be oops, I didn't display exactly as I wanted because I wanted that to be centered centered. That's sort of an example of how you might go about using literate coding with our to render in your slides. Let's see what else is useful and it's not much more that we really need to talk about but it's nice to know that you can if you have HTML widgets, you can have interactive parts of your slide deck. So leaflet, not all of the HTML widgets necessarily will work in sharing them, but a lot of them do leaflet is for for doing maps. DT tables is for interactive tables if you need to click on things or just find the things that are peddling 1.4. You know, that actually is a fully functional interactive HTML widget. And since sharing and slides are actually HTML or rendered as HTML, they work. There's some stuff here about auto play and all that you can read through that if those are important. Just want to see if there's anything else that I really want you to know about. Code highlighting probably is, if you need to highlight some code, you can get these yellow lines based on how you use your markup. There's another example of two lines that you want, that you want to point out. And then he goes on, on and on to display some stuff. So what I thought might be useful at this point. But you are welcome to redirect or ask questions. But I wanted to suggest why don't you all make your first sharing and slide deck by going to our markdown and just play around with it for five minutes. And we'll come back and you can and you can unlike at any point and ask any questions but we'll make sure that there are no further questions. And then after that, I'll show you how you can use some other packages to manage more of the style of the slides right now you can set fonts and colors and things like that. So that's my suggestion go ahead and make your first slide deck but if anybody wants to unlike. Go ahead and do so now and ask a question. Just in case you're still looking at my screen I will remind you that in order to make a slide deck. I'll start by going to new file are marked down from template. Ninja presentation. Okay, and I'll set my timer for about five minutes. So that produces a pretty basic document. And in my case it leaves a lot to be desired I'm not crazy about the fonts. I don't especially like the lack of color. I like the pink, but how to change it. And the answer is that one of the easier ways to change it is to start using a thing called the sharing and femur. Okay, so that is this library right here. And then you remember I said there was some stuff that you wanted to put up in the top of the other document. Some of it is related to sharing and femur. You want to install sharing and femur course it's a package just like anything else. You could just type in sharing and, and it's the second one that shows up. And once you do that, you should definitely check the. Oh, it's in my documentation document I'm 100% certain so it will be, it will be a little bit farther down. But once you run sharing and femur, you can run this. This is their example, the example style mono accent, where you, in this case I'm just running the false base suggest, which is to use this green color. I'll show you a little bit more about how you can identify those colors in a minute, but that's a hex code for kind of a green, and that's all my identifying the base color. And then it's also identifying different fonts depending on whether or not they're header fonts text fonts, or code fonts. Again, I just use the defaults but I like them all better than. And what comes with sharing in my default. When you put that up at the top and then the other thing that you have to do with this one of the things this will produce is a file called sharing and dash theme or dot CSS, which is a cascading style sheet that's what CSS stands for. And so I should have, there it is, produced that file right there sharing and theme or CSS. And so then I need to add my nine. And that's all in the documentation for sharing and theme or which we'll look at in just a second. But once I once I have those two things I can re render the files. And now it has this green and these new fonts. And that I have three lines commented out here. You could comment out these two lines. On the example and uncommon out these three lines. And there I'm using some specific colors that Duke has blessed as part of the Duke color palette. So, let's just see what happens when I click save. See if it re renders and blue that did. So that's where I got the blue. And now I've got a blue instead of green. And then if I can get a secondary color to show up. It'll be in this crushing blue. We'll talk more about that. But. So this reminds you where you get your documentation. Let me just point out that there's a link right here in this slide to chapter seven of a book called the definitive guide are marked down the definitive guy. It's also written by you. And chapter seven is all about how to use sharing and slides. So it's worth knowing that that's there. It's probably worth a read if you find that you like this. And there's another bit of documentation. Let me just go ahead and click on that. There's chapter seven goes on for a while. There's a whole bunch of stuff. It's very useful. There's also the Sharon can wiki, which has some really useful things like slide layoffs like number footer header, how you can deal with stuff like that slide margins link color. All of that is very useful. So if you wanted to do something with slide number. This tells you how you can, I think, you can tell you how you can mask the slide number I forget how you can change the format. Here's remark JS remark JS again that's the foundation for sharing and slides. So here's a link to the remark JS wiki that we talked about. And there's some useful things there remember we're talking about class like middle and center. It's more on the different kinds of classes that are available more on how you can manipulate background images. You can make things like templates and layouts that get carried through to all of the rest of the slides. So if you have a template that you really like, you can generate this and you can turn that template on and off as needed because you might have a slide that should not have the template on it. We talked more about cascading style sheets which is ultimately the way that you really, that you really affect the style of something so for example, I'm using Markdown right here to make that a header size one remark JS. But that's just a way you don't have to remember this but just a way to do an HTML header size one. Okay, so if I re render that slide, why did that happen. Oh, I didn't each one. It looks the same. But the nice thing about HTML is there's a feature where you can affect the style of something. So I could say color. Let's make it easy. So, all of those style features. That's what sharing and theme or suppose it makes easy on you, but if you really want to start tweaking individual slides, you're going to end up editing style sheets, style sheets like we identified right here. Right, so I'm just going to show you real quickly. I probably don't want to get into this right off the bat I just want you to be aware that it's possible. So with I open up this style sheet. This is what a really elaborate style sheet looks like you can create a custom style sheet that feeds off of the elaborate one and override some things. And that's how people start to really customize. But this is not a class on style sheet so I just want to point to point to you the fact that there's information about how style sheets work. And if you really want it if you really get into this and you're struggling with style sheets by all means reach out to me because I've done a fair amount of work on this. And I can usually point you in the right direction. So style sheets. This is why you might want to use something like sharing and thinking right because you can quickly define some primary colors and some fox and some styles. And as I mentioned to you. I created the code to use blue, some Duke colors. I got those colors from this link right here. It says Duke colors, which is a web page that is basically a style guide for Duke University. And here's the main hex color code for Duke blue what we call Duke blue. Apparently Duke has a royal blue. That would be the hex code for that. Here's the Prussian blue that I had used in mind. You know if you want to use dandelion or cast iron or shackle for all of those hex codes are right there. You don't have to use those you can do anything you want. But if you wanted to make it look very Duke like. And then what's really cool about sharing and theme or is not only does it theme your slides with some colors that you choose, but it has a feature. That will theme your, your GG plot with the colors that you choose now in this case, I pulled this image off of the Internet so it did. If I had generated this, this GG plot image within a code chunk. It would then have proceeded to use the Duke blue colors that I chose just a moment ago but as you can see it's the shades of green that were used in the default green that I started with. But that's I think a really nice feature it's a nice touch stylistically. And then this coming to the end. I showed you right off the back and I had finally kind of found the magic formula that I like to work with. And so there are things like a slide with an image on the right and slide with an image on the left and different kinds of two column slides. And all of that comes from this cascading style sheet called apron that has these things called slide lands. And if I click on that, it'll start to look to you a little bit like how you may be familiar with PowerPoint slides right you can choose. You can use these, these words up in the class section of it and slides you can make a title slide, or an image left or a two column slide or three column slide, and it will allow you to do all of those renderings with the apron style sheet. And then there's also the Descartes style sheet that allows you to do things like imaging image placement. So I'm going to slide forward here and see if I can find an example. That's kind of cool if you want to do sheet music. Like this, these kinds of very specific image placements and box placements start to become a possibility with even more style sheet. And then lastly, there's a thing called tacky arms, which is really a way to make things like this box. That's done with something called tacky arms. And, you know, we could get into that but I kind of think that most of you will find that level of detail is not appropriately placed at this level of the introduction. What I would recommend at this point is after I after I introduce the next exercise is that if you want to shout out a question. I would recommend that you go back to 00 underscore markdown.rd and see what you can do about turning that into a slide deck, where every two second level header is a new slide, and just start to play with some of the realities of sharing And while you're doing that, it's going to be open season for any question that you can think of and I will try my best to answer it. And what I'll do is I'll give you about maybe five, six minutes on that. That's one of the suggestions go into your files menu. Open up 00 are marked down and turn that into an actual sharing them slide slide deck. Alternatively, you might have a brief bit of code that you're working on. And you might want to just start on your own slide deck. Can I ask a question. Absolutely. Yeah, so I was. Maybe it's easier for me to share my screen. Sure. So basically I was trying to make the slides for the, the code chance. And there is a figure on it. And the figure it seems like the figure, the size of the figure is too large to feed in the slides. So I was wondering how do I resize that or how do I make it to to feed. Yeah, it's a great question. Let me just make an example. So if I turn, let me just real quickly. I'm going to turn this mark down into a slide deck. And I'm going to do it by going over here and grabbing this code and putting that in the top. Oh, actually, all this copy. So I'm going to make this right here. And then I'm also going to grab all of this. And that should be the setup for making a slide deck. So this should be slide one. And then I'm going to make that slide to that slide three. But then up here instead of slide to do an example. So let's resize image. Right. So let's get some code going from your library. So if I save that and knit that. I now have there's my code and now we want to deal with the image size. So let me just do this. Just to make sure nothing crashes. I'm going to change that over to. All right, so the first thing I'm going to do this case in my case is I'm going to change that to show output only. And the image is still probably not the right size is close enough. Now, if I want to change the size of that, I'm going to just click on this gear in the code chunk. And change this to use custom figure size. And then I might make it, let's say, I'm going to start with 10 it should be it says it's inches. And I'm going to go to six, and we'll see how that shows up. And I might also just because I like to change the dev to SPG, because you usually get CRISPR graphic out of that. But that did a pretty good job of generating particular size right. Okay, well, but you guys are welcome to unlike it anytime. You can see that I did in fact, start to turn this into a slide deck and saw how I did it. A more traditional way would have been to start. You know, specifically through new file and our markdown. And then in my case, at this point I would probably start with sharing and theme or the ninja themed presentation but all that does is some of the stuff that I copied and pasted. So I might add author. And date. Today is April. Or as you may or may not know you can. You can actually do inline our code here so that should bring up some some more things and then really the simple, the simple techniques are just to are just to put these slide designations in the beginning. This one I might change to classical middle just because I'm not always crazy about it when it's all the way up at the top but my mind changes on that on a regular basis. Then you saw the resized image one. Should be able to do a title here. And if I did that I'm like, yeah, that's probably not what I want because it's so small but there's other, there are other functions in ggplot to make those fonts larger and smaller. But then you'll no doubt run into here's an example of where I've got too much stuff and then I might just want to tweak it so that I have two slides that might be the easiest thing to do. That's probably this in this case it's going to be three slides. And that's pretty much that's pretty much the bulk of it. It doesn't really get more complicated than that. I want to definitely would encourage you to use this there are other ways to make slides just so you know if I go to a new file or markdown. There's an option right here that says presentation. And you can make I don't use any of these so I can't really tell you much about it but you can make IO slides, slidey slides be more slides, or even PowerPoint slides. I'm pretty certain that PowerPoint slides and sharing and slides work quite similarly together in that, you know you're using our markdown and probably all of them using our markdown because it comes from this markdown template, and you're probably designating the slides differently, but I don't have any real constraints with any of the others. The sharing and slides work pretty well in my opinion, you may see them around. So I thank you for your attention. You can always get in touch with me through the email at my department ask data at DukeWU. And if you want to you can make an appointment with me. You can schedule me. I wish you good luck. And I will record this and send you a link when the recording is done. But just let me know if you have any questions.