 and I'll show you how to get them because they're good to have. Okay, so we have this browser here and in the repo called GT Workshop under my username Rich Ian in. I'm gonna share the link, Ashley, because that seems like really nice to do. Let's see here, chat. Okay. I'm gonna share with everyone in the meeting. Okay, so right here, this is kind of like the sort of central place where you can find all the workshop materials. And it's totally optional. What you can do is you can either watch all my demonstrations or you could download these materials and work along yourself. Or you can go to this RStudio Cloud project. Okay, I'm gonna click onto that and I'll show you what's there. Okay, so basically when you get here, you're asked to log in. And I'm gonna log in myself just to show you what is even in here. You might not have seen what was called RStudio Cloud, which is now called Posit Cloud. And what it is is a RStudio IDE in your browser. And if you go to the project that I had the link to, it basically brings you this GT Workshop project, which is essentially yours. You can go to it anytime you want and you can just run the stuff in like basically GT's load for you. You can just run these R&D files. You can just go into any cell and just run the cells and see what happens. And this is exactly what is in my workshop materials for today. So totally up to you. You could do this. You could just download what's in here just through this button. You can download the zip, open it up in your own RStudio or in VS Code, whichever you wanna use. Or you just kick back, relax. This is all recorded. All these materials will always be here and just watch what I'm doing and absorb when you're about to see it. Totally up to you. So I just wanted to show you all that as a sort of starter. Okay. So the first R&D we get in this workshop is Workshop Contents. What we're gonna do is, well, this is three hours. So it's a long workshop, but it doesn't really cover everything that GT has in the package because it's a very big package. But I'm gonna try to get through all the basics. So you're making tables that you want to make out of the data you already have. So I'll go over a few things. How to create a table, how to modify the parts of a table, the components as it were. That's in module two. These are all numbered. And then between modules two and three, there is this practice where we just have some code cells where you can play around with some things that were covered before. I'll allow a bit of time, not too much time, but a little bit of time in this workshop since we have so much of it, just so you can go in there and try a few things out, experiment a bit. And then we'll head on to this. So this will be the second hour, modules three and four, for adding your data and then modifying the columns of your data. Okay. And then at the beginning of the hour or just before the top of the hour, a little practice session. Again, it's another RMD with just a few things that you could work with. And then the third hour will be the final two modules, which are summaries and table option functions. Okay. And then a final practice or you can just leave. It's up to you. Okay. So we're going to start right away with this. First of all, any questions? I can see the chat. And if there's any questions coming in, even during the workshop, feel free to just put them in the chat. Feel free to even like turn your microphone and say something. It's totally fine. I'll be talking a lot. I'll be showing you things. Any way you want to like get asked questions or what have you is totally acceptable. Oh, recording. While here it's going to be recorded and published on YouTube. Probably a few days from now. I'm not quite sure when, but it will go there. Yeah. Great. This is very working. Okay. So we'll get started. I'll look at the chat every once in a while to hide it for now in the corner here. Okay. That works out pretty well for me. Great. Okay. So let's go to module one and this is creating a table. So once you get GT installed, you can use like right away pretty simply just with the day you have. You can use it with example data, data that you've manipulated and reshaped and otherwise processed. You can just put it into a table. And why do we do this? Well, we can have it as a standalone HTML table. You can have and put the tables in shiny. We can use them in quarto or arm rock down. Lots of places we can have standalone documents which are RTF or Word documents just with the tables in them. So lots of ways you can sort of use the tables that you make. Great. So the first function is the GT function. So that's the entry point into the package. So you have data, you introduce it to the GT function. And there's some other functions here that start with GT. I'll get into those a little bit later. But the first thing you need to know is the GT function. And with each of these, I put the signature of the function in. So it's GT. The data in this case is the actual table data. Could be a data frame, data table, table. Those all work. Just put that as the first argument to GT. And then there's some extra things here. Not essential always, but I'll show you what they do. Okay. So what I wrote here is the GT function trades a GT table object. Okay. And once you have that object, you can do further things, just like what you might do in GG plot. You know, you start the GG plot and you do things, yeah, layers. And, you know, you do different things. It's the same sort of thing with the GT. And of course you want to, you know, use data. You may not have your own data ready, but that's okay. Because the GT package contains a few data sets. So we have 10 data sets and we'll use them throughout the examples. And also these data sets are used in the examples in the documentation. So they're kind of everywhere. But for our purposes, we'll mostly use this example data set just because it's only, I think 11 rows and eight columns wide. And for that reason, it's really good for examples because it fits on a page and you don't have to scroll anywhere. You just sort of see the table in its entirety. So it's eight by nine. Okay. So it's got these columns. This is just a table as we're printing it out. It's got a number of columns starting with, you know, character, factor, date, date, time. It's all string based. And then we have these categories here, row, and then group. We'll use these coming up. Okay. So first let's use example, the data set and pipe that right to GT. And we'll get the result here in the chunk. So basically by default, it displays it as an HTML table. But we see here, this is not much different than what we see up here, right? Just in HTML table form. Okay. And this is essentially, unformatted is just like the table but not too much, you know, done to it. Okay. So yeah, we see the column labels and the body cells. We just want to name things a little bit. So these are column labels. These are body cells. We'll need to know that later on. Okay. So we can modify the layout right in the first step. So we have this column called row right here. And it's got these, you know, these labels, row one, row two, so on and so forth up to row eight. So these can serve as row labels or row index. So we can specify that with the row name call argument. And then in quotes, we use the name of the column. Right. Okay. So let's actually run this. Okay. So what's been done is a slight variation on the first table you can see right here that row column, it's now to the far left and there's nothing above it. Essentially these are row names, right? We call this area a stub and it's just an area to put row labels. So you have a summary, you want to label what each of the summary rows are and that's what this column is for. Okay. It's called a stub. Okay. We can even do more things to this table. Sets of rows can be grouped. And so what we have, we could have our row group labels and row groups. Okay. So better to show it then to just talk about it. So this group name call argument in that you specify what is the group call. In this case, it's more categorical. You would have categories instead of like something different with each row. So group A and group B, that's what we see here. And if we do run this, we get this table. We get the rows divided up into groups like so. And then a label above each that takes a row. Okay. So now we have row groups and row labels. We can modify these labels. We can style them, do all sorts of things. But this is what you get initially. And the grouping is pretty important because later on we may have things like summaries and we may want to summarize things group-wise. Like have summary rows which pertain to this group or the other group or all groups. Okay. So it's an important division of the table rows. Okay. So I'm doing a thing here where I just want to demonstrate that even if the rows are in an order which like the groups are not one after the other, like sort of like mixed, like so. I'm just randomizing it right here. See the groups are sort of like all over the place. What will happen is this will still organize the different rows into the groups. So we'll gather them together and maintain the same order or at least the order that we have going from top to bottom. So it'll be different every single time as the rows are jumbled. But you can at least see a group B was the first row. We can at least see that they're together. They're unified. So we can sort of keep going with this. Okay. So knowing this is kind of best to have things arranged beforehand. There's no real facility yet in GT to order different rows. So the order should be sort of like done beforehand. Okay. So this is a pretty odd situation, maybe, but say you have a data frame with row names, the empty cars data set has that. If you just run down the console, we'll see right here, it's a group to top quite a bit. But we see here, this looks kind of like, you know, the table to be demonstrated before. These are actually row names. They have no label. They're like a separate property is like a special column. You know, that's not too common, but we can use that. We can say row names to stop equals true and it will take these and put those in the stuff. Okay. Demonstrate that. There it goes. All these car names are in the stuff. If we didn't have that, what would happen? Well, they just wouldn't be there. So, and this is a pretty odd circumstance, but if you do have data frames with row names, you could use this and preserve those. Okay. And a dplyr, it's pretty common to use. If you use it, then you might be familiar with the group by function. I know it's getting less and less use as it's some of it being phased out. But if you use that separately on some data and you generate a group table, GT will recognize that and it will take, you know, the groupings and apply them. So I'll show you this right now. So, example grouping by the column group and then putting it into GT and just specifying the row names. It'll be like this, not different than just saying group name, call group. Okay. So you're probably wondering, you know, why do that? We can have multiple groups. You can group by multiple things like this. So it's actually just show this data set like so right here. So we have group and size. Sorry, we have groups that are type and size and we're just taking three rows from each of those groups and we can put the GT and then we can have this special argument which says, well, between the different groups, we're gonna put this little text separator. So supreme large, three rows, supreme M, three rows, so on and so forth. Okay. So this is a lot to do with GT, that function. That's basically how you use it. There's not too many arguments in there that you really use. The main ones are the row name, call, group name, call and we'll see later on that you can specify row groups with a different function later on for more control if you need that. Okay. So that's your entry point into GT. Basically use the GT function with a few options. Okay. So now I'll go into a few sort of extras that deal with, you know, getting it, viewing a data set and this one is GT preview. And what that does is it just allows you to, it's almost like using like, say for instance, the head function and GT cars gives you the first six rows, but it gives you like this in the terminal because GT preview and what it'll do is it will give you an HTML table. It'll give you the first five rows, the last row. So you can sort of see the, you know, the extent of the data and it'll show you how many rows are sort of in between. And you can change all the stuff. You can change like all aspects of like how many rows you show initially, how many rows you show at the end. And even whether or not you want to include the, include the row numbers. So in this case, I'm gonna see the bottom end, like more rows at the bottom. And I don't want to see the row numbers. So that's for this text right here. Great. So we see a little gap, see there's more data, but essentially here we see that first five rows, last five rows of the table. Okay, so you can see a really big table and you have to worry about like the overflowing, you know, bringing huge, huge table in your browser. Okay. And this is kind of skipping ahead a bit, but it's good to sort of show this first. So you know that, you know, when you actually do make a table that you want, you can, you know, either export it or use it in different places. Sometimes you just want to export it as a file for reasons. And you can do that with the GT save function. So pretty easy to use. What you do is you make a table. So I'm gonna do that right here. So I'm calling it GT table. And I'll just run in the console to prove that's there. Okay, that's the table. And we can write it to say an HTML file. So we do that with GT save. And the first or the second argument is really file name. And the way it works is you don't specify what kind of file you want, you just give it the file name and you ensure that you include the right extension. Okay, so .html, you know, then it infers that you want each small file. If it's a .png, you're outputting a graphics file, like a .png file. If it's RTF that you want, .rtf. And then if you want a .x or a Word document, it is ..x. And in the files here, I do have some examples of those. I'm not gonna run them right now because, you know, it takes time. But essentially, you'll get those files out like this. Like the file you name, as long as the file name extension is recognized, you'll get that file. Okay, that was pretty short. The beginnings of this is kind of short, like the GT function, there's not much to it. Pretty important though, so there's some time. I'm looking at the questions now. Group I is phased out. Well, it's not really phased out. I think it's always gonna be there, but it's de-emphasized. I think what they're doing right now in Deployer is putting the .by argument for groups. So, you know, group by is not as prominent, but I think it'll still be there, but it just won't get the attention in the future is that, you know, it has had before. Okay, let me try to see any more questions. Okay, I don't think so because this is pretty basic stuff. Basically just using one function to get the data into GT and other functions to get it out or to preview it. Okay, so that really is it for this. So I'll move on the module too, which will be a much larger module, to be sure. Okay, and this one is to do with, oh, I have a question. Do you have, do you set a working directory for the GT save to export to it? Okay, so what it does is it's by default, it will save to the working directory, but you can set a path. So let me just like go into here and you can set a path and what will happen is it'll just be prepended to the file name. So you can set a different directory there. So you want it in, you know, like HTML, like that's sub directory. So it'd be like your working directory, then the sub directory HTML, and then that would be it. That's how it works. And I believe if you just use this, you can use like a long path. So you want it to go at the beginning of your file system, like something like this. You could just use that. If you don't want it to go into a sub directory, but a path repo. Yes, there's definitely a repo for the project. So the question is, is there a repo somewhere? Yes, okay. So I'm gonna show that again. Basically it is this, I'm gonna copy the link once more and share that. Oh, great, someone's got it. Excellent. No, no, no, it's all good. So yeah, basically this is it. And all the documents here, like what I'm working through is here. Alternatively, you can use the cloud project. It's just replicated there. It depends how you want to use it. And you just install GT and grab these files and then off you go. So these will always be here. These have been here for a while and they'll always be updated as the workshop is delivered in the future. And I actually did update this like the last two days because new versions, they slightly update things, add new arguments to functions, but don't really cause problems with backward compatibility, just like we're mostly adding new arguments. Okay, so that's where this lives. Okay, so I'll go to part two, it's module two, really. So adding or modifying parts of a table. Okay, so a GT table, it can have different parts, not just like the column labels and the body, which contains the cells and the stub. There's actually like two more, essentially the header and the footer. And we have functions just for like dealing with those parts. So we have the function. They'll become a tab underscore. So tab header is one. And it's quite simple. You can add a title and optional subtitle to your table. Stubhead, that's basically a label above the stub. By default, there's nothing there, but you can add something there, any piece of text that you want. Spanners are labels over top of one or more columns. It can have multiple spanners over top of spanners. So that's what that function does. Tab row group, this is a way to manually create row groups or groups of rows from an existing table. And you give it a label and it creates a group. Source note and footnote. These are for pieces of text in the footer. And this is quite obvious what it is, but these are functions like you do that. A source note essentially is a note that doesn't refer to any one point in the table. It could be used for like the table source or you can put any bit of text that you want. It's up to you. Footnotes are a little bit different in that they put in like footnote marks in different parts of the table. And then the note is at the bottom of the table with the same work. Tab style is for styling the table. This is for HTML tables. And you can do all sorts of things like add background fills, change text, add borders, things to that effect. And tab options is kind of like almost everything else. It's like a global set of options. You can say change the width of the entire table, change the background color or the font of the entire table. That's where that stuff lives in tab options. And if you've ever used dplyr, you might have heard of things like tie select or select helper functions. And we have that in GT. We can use that for the columns and also for the rows. So long as you have a stub and labels in the stub, those can be used as indexes and you can do things like matches on certain rows or starts with on certain columns and combine these things in interesting ways. We also have two helpers. I'm just listing a ton of functions here, but we'll get to the actual examples. Help us for transferring text. If you have some text which is marked down and you want it to be interpreted as such, you use MD, same goes for HTML. If you have something that's like write HTML and you want it to be like this, this should be the HTML that's in the final table, you would use that. And then all sorts of helpers for targeting locations. These be in with cells underscore. And perhaps confusingly, these helpers for defining styles would give a singular cell underscore. Apologies for that, but that's what we have. Okay, so let's start with the very first function that I have in this module, tab header. So I can add a table header. So best go to example here. So we have this GT cars. I'm gonna show you the table before a header. Just start running it. Okay, pretty small table. We only sliced five rows out of it, include three columns. That's fine. Now with the tab header function, we could use different labels for the title and the subtitle. Because we have markdown here, we have two asterisks for GT cars for bold, back ticks for GT cars that makes it into a code font. We mark these off with MD. Okay, so let's run this. Okay, great. So we see here, yeah, it's indeed interpreted from this markdown text in both cases. And by default, the title's a little bit larger than subtitle or subtitle is a little bit smaller. And you can change the sizes in tab options and also in tab style for that matter. Well, that's a later thing. But for now, if you want the header, just use tab header. Okay, tab stop head is kind of similar in a way. It's very simple. You give it the data, which is the GT object and some sort of label. And you can use the label in the same way. Provide markdown or HTML or just raw text. And it adds a label. So I'll show you a before and after. So this is just the table going in, same as before, except we have the stop head right here. It's the top left corner. There's no label there, but we can add a label. We're being a bit boring here, we're just calling it car. But I think that's fine, just to demonstrate that this works. Okay, I thought it's not a question to pop in. Oh, MD, okay. So MD doesn't do anything outside of GT. If you would use MD, it would basically do nothing. But inside functions, like tab head or any place that accepts a piece of text, it indicates a GT that, yeah, this is markdown. So if we didn't use this MD, you would literally get like those asterisks inside the table. Yeah, see right there. So MD is saying, this is markdown, converted to the output format that we're using in this case, it's HTML. And then we'll get the thing we need. So anytime you have markdown, use MD, round it. Otherwise, it's just literal text going in. Okay, so it's the same sort of thing, but tabs of head, we can do this here. I just want to demonstrate that it works. Car, what's made this in italics, and we sort of see it, it's now in italics. So it accepts that. Great, so tab spanner, this is a much more complicated function than the other ones. But there may come a day where you need to have spanner labels over top, and it's actually quite useful. So what you do is you've used tab spanner, target some columns. These are the columns that would be spanned over with a label. And let me just demonstrate that with an example. So let's start with GTCarSmall. What I'm gonna do is I'm gonna just like create that table, basically the data table, and we're gonna use it a few times. Okay, so GTCarSmall, this is without the spanners, this is just like the labels over top, different columns. Okay, great. But now we want to add a spanner over top, some related columns. Okay, so it's a way to add structure to your table. So we'll have one call of performance, that's gonna be the label. And again, we can just mark down here, we can make it nice, use capitals or some larger text, but in this case, we're gonna keep it simple. And the columns that we're gonna span over are these ones right here, anything that starts at HP, TRQ and MPG. Okay, there we go. So now we have the spanner and the label performance over top of those columns. And because tie select and targeting columns, select helpers is kind of important and useful. We can do all sorts of things like inside of C, use starts with anything that starts with HP, anything that starts with TRQ, anything that starts with MPG. And this will give us the same result. Right? So we do interesting things. We can do things like exclude columns with a minus. There's really quite the language there with this. Okay, and another thing you can do is, or another thing that GT does for you is, say for instance, oh, sorry, a column that you want to be spanned over is far away from the rest of the columns. It's not next to them. What will happen is tap spanner and we'll gather those columns together and put it in the first spot where the first column is seen. So this is called the gather argument. And by default, it's true. And that's usually the case for most people who will want to make sure all the columns that are under spanner are together. Okay, great. So that's what it does. So basically performance is still over all those columns, even though HP was far away from HP underscore RPM. Let me show you the difference with gather equals false. Yeah, kind of interesting. Now we have a sort of split spanner, which you could definitely use in some cases, but it's not the usual preference. So that's why the default is true. So it's basically moving some columns on your behalf to make sure this whole thing works that we expect it to work. Okay, I believe I got a question because I saw some movement in the chat. Oh yeah, gathering. It is good stuff. And yeah, math notation MD. Yeah, we definitely have that going on. Yeah, yeah, definitely. Follow that link and there's definitely a way to get the symbols going. So the next question we want to go to is tab row group. So we saw initially that you can use GT and specify row groups to split up your table into different groups of rows. But we can do that individually. Like we can have a separate call of tab row group for each group that you want to generate. Okay, so let's do that. So we have GT cars. It's one of the example data sets in the package. And we want to create a GT table and add two row groups with the labels numbered and NA. So it's a group with that label associated to it. Okay, so let's try that up until the point where we use tab row group to see where we're starting. Okay, so we have this table. And now we say we want the rows that have this match. Okay, I don't know if you know regex well or not, but what this means is at the very beginning, that's what this carrot means. Anything in the set of zero to nine, anything that begins with a number will be the match. Okay, so essentially these rows right here, all the 458s and the 488 will be the ones in this row group called numbered. Okay, so let's run that. Okay, so we see we have this row group now says numbered. Then we have a double line and then all the other ones. Okay, so basically these are the ones which are the others group. They're like basically like a default group because they're not, they haven't been captured. So the sort of like our others. What we can do is we could, you know, try to make it so that all the rows are accounted for. So in this case, what we're doing here is we're using an expression inside of rows. And HP, as you can see here has a number in each of these rows and we can divide between them, you know, ones below 600 or ones above 600 and then, you know, split them between two different row groups. That's what we're doing here. So I'll do it one statement at a time so you can see the difference. This is without a row groups and now we're collecting into the row group with the label powerful rows where HP is less than 600. Great, so we did that. These ones are the ones remaining. And let's do these ones right here. Great, yeah. So we have here is a division in rows based on some expression based on values inside of column. Okay, and we gave them labels. So that's that. Okay, we can do more interesting things. We can actually reorder the rows or the row groups. So you didn't like that order at all or you have a bunch of them and you wanna have a very specific order. What we can do is you can assign IDs to each of these and then use those IDs to reorder the groups. Okay, so by default, the ID is the label. It's basically just this and the label is something simple like that. But we have something that's more complicated like this markdown stuff and you don't wanna repeat that as the ID. You just wanna give it something that's a little bit simpler. You might even call it MP to keep it super simple. So now we have an explicit ID for this group. We have an ID that's just implicit and called powerful and now we're gonna reorder it. Okay, so now powerful is on top. We can definitely of course change it just to show you that it works like so. So in this case, it's reversed and if you get the wrong ID and it will complain to you. So that's how that works. So IDs are important for things like this and also if you wanna do things like styling as well. You can reuse these IDs as a quick way to reference a certain location to be styled or what have you. Okay, well, there are any questions with that at all. Nope, it doesn't seem to be. Okay, good stuff. Okay, next function we're gonna talk about is tab source note. Pretty simple. It's about as simple as the other ones we saw earlier like tab header or tab stub head. It's basically data and some piece of text that goes in the footer source note. Okay, so we can do this and it gives us this right here. This example data set is available in the GT package. Looks like we have marked down here. So one thing we could do is again, wrap it in MD and then the source note will have the correct formatting that you anticipate from what you wrote. And some more examples here, but what you can do is gonna have more source notes. You just have a separate call for each. So tab source note. Again, I'm not gonna put down the argument name. I'm just gonna say another note. And if you run this, we'll have two notes together like that. Yeah, and there's options as well in tab options to put these all together in one paragraph separate by space. I could do all sorts of interesting things with that and also the footnotes sort of combine together or have multi-line. Footnotes, they're simple just like source note in that they take a bit of text but what complicates things is this locations argument which gets complex pretty fast because what you do is you can point to any part of the table and say that's where the note should deal with or what are concerns. So for that matter, we have to have a number of helper functions to target the location that the note goes into in the table. So we have things like they'll begin with cells, title, target the table, title, subtitle, stop head, so on and so forth. And they have different arguments which are optimized for each of the types of locations. Like for instance, cells stub will just have a rows argument. Cells body will have columns and rows so you can get intersection. Yeah, so best to see examples to understand how this works together. So we'll start that with this example table I'm gonna run that without any notes and I'm gonna say this is a factor column. That'll be the note at the bottom and what is the factor column? Well, it's gonna be a location dealing with column labels. In this case, we'll use the helper function called cells column labels and the column will be factor. So the note will appear right here and if you run it, it does appear there and starts with numbers, you can have letters, you can have capital letters, you can have symbols. You can use any sequence of footnote marks that you want. You can devise your own sequence as well. There's also ways to style it here separately from how you style it here. So there's a whole other thing there. That's not actually not shown this workshop but it's there if you need it. So that's basically that. I will move this around. So I'm gonna try another example because I don't believe I have more examples here but it's important to show cells body for instance. Okay, so we have columns argument but we also have the rows argument somehow it's not showing there but we can say the first row with number one. Okay, we use numbers. We don't have a stop here to use actual labels so numbers will suffice, okay? This is a factor value in this case. Okay, so if you run that, we'll see that the number one appears at one and now we're saying this is a factor value. Yeah, and you could do things like if it applies to an entire row or entire column you can leave out rows and it'll run down the entire length. Sometimes you want an expression for rows for num is greater than, I don't know, 500 for instance. So more or less programmatically generate footnotes and have something that matches the expression. Okay, so that's tab footnote. There's no questions, I'll keep going. The next function to look at is tab style. So this one's probably one of the more complex ones even more than tab footnote. It takes the same locations argument so use it the same way with the cells functions to target something, some cell or number of cells. It's also a style argument and this style argument takes in one of these functions or multiple of these. So you can modify the text, you can modify the fill of a cell or you can modify the borders. Okay, so we'll actually go to an example right now. So we have a zipple. We're gonna make a very simple GT table. Just selecting two columns and there it is. Okay, so for example, we want to take every cell in the body so let's just use cells body. So it has two arguments, they're not shown here but this is what the defaults are, everything. Okay, but we don't have to actually put those in, those are the defaults. And what we're gonna do is all those cells are targeted. We're gonna use the cell text function and say the font should be times your run. So let's run that. And you can sort of see it, it's using times your ribbon now. And we can alternatively use something like cell fill which will have a different set of arguments. So I think one is color. I'm not sure whether the first one's not showing up ever but we can choose yellow for instance because I'll appear nicely and there we go. So we can just add a color. This could be a color name, it could be a hex code for a color like this. You know, could be also be CSS colors. I think Silver's one is CSS but I'm not quite sure. Yeah, okay. So it doesn't appear here but it's actually something you can find on the web. There's a few of those that don't exist in X11 colors and you can still use those. Okay, so the other thing you do is inside cell text we have this other function called Google font and you can use anything from the Google fonts surface as long as you know the name, it could be used here. So let's try that right here. Okay, so in this case I'm using IBM Plexons and that's being used throughout the entire table mainly just in the body, in sales body. Okay, and we choose away here. We can drop that down to like 400 is a default and it can even go smaller. All the information is available inside, you know, the Google fonts website if you want to see what this means. Okay, so I'm seeing a question here. For the Google font, known store font is needed. Yes, you just have to be connected to the internet and it should definitely work as long as you know the name of the Google font. I think you just have to go to fonts.google.com. One of the best way to fix an issue with a table where it makes you need to identify data in every row or row group label. Yeah, so I think for that you don't even just need to have a column, not a column but like a stub which has unique names. I think you can use that to target or if you're fine with using just numbers that's totally fine too. You can also target by other values inside of the columns too. So that's totally possible. There's lots of flexible ways to do that. There's no themes like GT summary has for anything that's like in our journal so far but that's actually a good idea. Okay, so let's look at another example with example and we're using tab style like a few times. So what we can do is for the different styles and also for the different locations you can wrap them in a list. And this is pretty useful because you may want to do more things than just like change the fill. You may want to change the text as well but you can do that with a list and just pop them all in there. So let's actually run this bit by bit. We'll do the part right before tab style. Oh, it looks like I did the whole thing but that's fine. Okay, this will show the whole thing. So the cyan what we're doing here is we're locating more targeting cells in the num column and only those values which are above 5,000. So those are getting the styling. And we're doing something similar with this other color and styling in italics. Anything that's currency less than 100 in the currency column. And I believe this one more example where I take this data, sp500, get a small subset. Let's run this part. What we want to do here is you want to say anything that is rows where the close value is greater than open, we're going to make that green. Anything with the open value is greater than close. We'll make that tomato and the color will be the text will be white. Great, so I'll see you do that. So it's almost like conditional cell highlighting. Okay, so any questions about these functions? It's like not. Okay, so move on to have options and then we'll go to like some examples and I believe that is it for this module and then we'll go to the practice area. Okay, so for this we'll create a table called tab one. Just run that. Okay, so what it does is it creates a table that has a few footnotes in it and some row groups. It's quite nice. We can modify the width of the table, make it 100% with tab options and this one argument called table with. Okay, so let's run that. Okay, now it's stretched. It'll fill 100% of the space in HTML. We can modify the entire background with table.background.color. This case will make it light cyan. It's a color that it recognizes. There we go. So it's the entire table and there's other parts of the table that could be modified. It's something else.background.color. You'll find that in the argument list. See for footnotes, you wanna use letters instead of numbers for the footnote marks. We can use letters like this under footnote marks. Then we see we don't have numbers here. We have A, B, and that's it, A and B. So data rows, they have padding. We can alter that. We can make it less than default. In this case, we'll use the px helper function. That just makes it five px. And this will reduce the padding between rows. There we are. And we can also reduce the size of the title and subtitle text. We can use keywords like small and there's a bunch more in the help that show you what you can use here, aside from like pixel values. There you go. Now these are equally sized and they're pretty small, the title and subtitle. Okay, so that's it for this module. I recommend taking a look at this right now. We'll provide 10 minutes. And at the top of the hour, we'll continue with module three. But take a look at this practice, RMD, and try a few things out in there. And I'll be here for questions. So feel free to ask anything you want. Oh, hi. Okay, so if someone has asked, I haven't actually been talking. There's a bit of a break right now. Anyways, but someone asked if I can go over a GT group. It's a new function in the package. Use for splitting tables. I'll show you the help and I'll grab an example from it. I'll show you how it works. Oh, there's no examples. Okay, let us take a look at some examples just from scratch here. So I wrote GT. So you can make a table one like this and another table, table two, say with a different data set or what have you. And you make a group just by using GT group and you just pass in the tables, table one, table two. Okay. So what happens when you print it out, it shows both tables side by side. The interesting thing about using a group is that in a document like an RTF or a word, it'll be a page break here, not just a break in between the tables, but a national page break. So you can actually use this to split tables across pages and not have them. As long as you know that the table won't run across a page and you're starting to be in the page, you're just doing like a listing of tables, then it's pretty good. You have very big tables. You can use GT split. It might have the example table. Let's just use that. That's table coming in. And we wanna slice it at row four, for instance. Let's actually run this. What we have now is after the fourth row, the table's been split and now we have the remainder of the table. If you have a very long table, you can use slice row every end. So let's do every two rows just to be extreme, give it a small table here. So it's being split a number of times every two rows being split. If you wanna split across pages and you think that your data is one row and you might fit 20 rows on a page, you might use 20 here and keep going with that to paginate across multiple pages in RTF. That's what this does. So for that reason, GT splits probably better. They might do a combination of all these things like GT split and GT group, for instance, like this, so you might do this. You just wanna make a really long document. Yeah, it's essentially repeating the table. Oh, yeah, yeah, yeah, yeah. Yeah, it actually can't be done. Good to know. But if you have a single table, this could definitely be used. Is there, sorry, this is the first thing I asked the question about the GT table. Are grouping the tables? Is there a way to, like, can you group them and then I guess you can do one table and then have it applied to, like, a whole bunch of tables that you're working on? Like, how would you handle that? Yeah, what do you mean? So you'd have something like this, but you'd have different tables, so you wanna split them all and then have them all in a group. They can just go in one document. Yes. Yeah, actually, as I found out, I don't think that's really possible. Unless you do this and pull them all out, it's a bit complex because it's not really built in yet. It's a pretty new thing. GT pull, oops, let's see the hell for this. So GT, sorry, let's go into the packages in GT and look at the names and there are a few functions. There is a way, but it's not really simple at all. This we have to know all the indexes and I believe we can use everything like pull one at a time. That's actually pretty complex and I think it's not really built in yet, but I would love to have the issue versions where I can just log that and make that work because right now it's not really a thing yet. Yeah, sorry about that. No, that's okay. Thanks. You're welcome. Okay, so I got a question. How are long tables more one page handled by GT? Basically, they just split like in a Word document, they just like go on the next page with the header intact. I think it's the same thing with LaTec tables, with HTML, there's no pages at all. So it just kind of keeps going down the HTML page. Question for PDF. I believe it uses the long table package in PDF or LaTec. So what happens is the header is repeated and it just splits across pages. Yeah, so it's like it just splits where it needs to split. Okay, so I got a question. How does GT handle the space between the text position and the cell? Do you mean the space between cells across? Hello? Hi. Can you hear me? Hi. Yeah. So I think about the position of the text in the cell. So centering the text or up, you know. Yeah, sorry about that. Yeah, for sure it handles that. Actually in the next module. That's so clear my question. No, no, no, it's not a problem. Yeah, we have things like a function called calls align and allows you to set the alignment of columns. That means like the column label and the, you know, all the cells below it. And also with tab style, you can actually do the same thing, but more manually if you wanted to. Let me show you that. So let's find tab style here. Just do a search. Okay. So we have this. Say for instance, we wanted to take, well, let's include char. Say for instance, we want this right aligned. We can do two things. We can either use calls align and then let's see, align is going to be right. Just, just in case. And then columns, those char. Okay. Now if you run that, now it's all to the right. We can also do center. Great. And if you don't want to do the entire column, you can do something like this. Use tab style and we can do align. Let's say right. Cells body, columns, char. And then we can say like rows, one to three. And it would just change a few of them and would leave the column able alone. You can hell that separately. You can do things like that. So you have lots of control. You want the whole column to be aligned or just a few cells. Thank you. My welcome. So I think we'll move on to the, to the next part of the workshop. It'll be module three, formatting data. So what we're doing here is we're using these functions. They all begin with FNT for format. This is not all of them, but it's quite a few of them. And, but they're the good ones. And we also have another function here called submissing. There's a number of other sub underscore functions as well for a substitution. Can't cover it all, but they are there in the help. We have a function called data color. That's kind of part of this. And we have a function called text transform. There's a number of other text underscore functions, but we're just going to deal with one because elements are just variations of this. Okay. So let's go to the first one, which is format number. So definitely a lot of arguments in this, a lot of options for exactly how you want to format some numbers. I won't go over all this, but essentially you can choose number of decimal places, grouping separators, whether you want them or not. You can scale the values, just basically just include a number and it will multiply the value by that value. You can do something called large number surfacing, which is getting figures like thousands, millions, billions in a smaller condensed form. You can use a pattern and that'll be used for decoration of the format values. And we have a locale options in this function and also another format functions, which let you choose a locale ID. And then the function will just take care of like all the options, essentially for like, or mostly for commas and or sorry, grouping separators and decimal separators. Okay. So it's actually run format number on the entire table here. So there's a table. It contains numbers and characters in the other column, but we can just use format number on the entire table and we'll just format things, which are numbers. Anything else will just be left alone. So you don't have to say it's just columns number or columns, no, it can just be the entire table if you want to be. Of course you can limit and constrain where the formatting should be applied. So in this table, we have two columns which have numbers in it, but we can just say for the num column, we want that to be formatted and this one should be left alone. Great. So if you left this totally empty, it would just format the currency column as well. So now it has two decimal places, so three. Okay. And we can change the options, of course. So starting with this, we just have the num column and it's formatted like this because there's large numbers. It uses scientific notation by default. But if you formatted like with three decimal places and we decide not to use grouping separators, we would get this. Yeah, essentially we get these periods for decimal place and we wouldn't get commas as you would if you didn't have this because by default we do get grouping separators. And of course we have a rows argument in the formatting functions. So we can constrain which rows we want to format. So in this case, we'll format the first three rows with four decimal places and everything else will be left unformatted as we get here. This is a case where we use an expression inside rows so we can more or less conditionally format some cells within a column. So in this case, we want to format only the rows or the values in currency, which is a different column, are greater than 30. So inside the num column, we're gonna format based on what's in the currency column. Yeah, in this case, we want four decimal places in the formatting. And we can see it right here. So these rows and some right here as well. Great. We also do a thing where we use a pattern and this allows us to decorate the finalized formatted value or all of them that you've targeted. So in this case, what we're doing here is we're taking values inside the column num. Only targeting the cells where the value of num is greater than 500. We want formatting where one decimal place is shown. We want to scale the value by a thousandth of the value and then apply this pattern. So the value is actually right here. This curly braces X is the formatted value and this is what goes around all of the rows that wrap around that formatted value. Okay, so I'm gonna run this. Yeah, this is our C right here. If I may CK, those are the ones which have been formatted. NA is just getting ignored in this case. Great, okay. So now we have a bigger example here. We take this data set called country pops. It's actually in the package. We do a little bit of de-pliering and some tidy R and we eventually get a table that will look like this. You know, smaller. Something that could be reasonably formatted by GT. And then we're saying row name call is country code three. So this would be the stub. So random left biologically insert into the stub and have that line next to it. And then we'll say everything else is a, that's a buy-sell. We'll just get formatting to just two decimal places and suffix equals true, which means that you'll get millions, billions and so on and so forth. So let's run this. Okay, so we get here is essentially that. So that's why we have two decimal places because these are otherwise integer values. But it makes sense when you have something equals true because they're all fractional sort of decimal values with this attached to it. And you can also do a thing where you might want to use SIG big and SIG big is say for instance two instead of decimals equals two. And then what that does is it just uses numbers significant digits. So it kind of like looks a bit nicer. And you can also change that to three if you wanted to. Or this sort of thing can kind of make sense. Okay, someone's getting an error with identical expression equals false, expression is missing with no default. I guess the first thing is, do you have a GT 0.9.0? So if you do install packages, so GT, you will get the latest, maybe try that first because I, and then maybe if you still, if that error persists, just let me know what that is. And I'll try running it myself and see what's going on. Okay, yeah, and GT does, I'm actually handle NAs. And if you do have NAs, I'll show you that a little further on, you can handle those more or less separately. So they're kind of like a separate problem. Can you use a pattern where you add a greater than or less than sign, you might for a P value? Yes, you can. So what you do for that is use something called sub small vowels. Let me just show you, there's actually an example in here because it's an older function, but let me show you that. And I'll do that either, I'll probably copy out the example. So right here, just sort of see it. Let me just actually grab that right here. So I can sort of see it inside the document and step by step, we have many tables as well. Okay, so I have this table which basically makes a range of like larger and smaller values. There's an A there for good measure and a zero. Okay, so this is the table, great. Now we're formatting it. Okay, so we're gonna sort of see some pretty unsatisfactory values here where like the precision is a definite problem. There is number smaller than that. But we can handle up with the sub small vowels function. Basically, when you're doing formatting or anything with text, you start with formatters, sub is for like a little bit of cleanup of those values which are not quite right. So this is the perfect case for that. And then third is text underscore functions which take the final string value from the first two stages. And then you just sort of get in there and fix anything that can't be fixed with any of these other functions. It basically sort of like making your own function at that point or doing something more custom. But anyways, this will handle that in a default case. See what it does is it does that. And let me show you what the arguments are so you can sort of see what's here. So if a threshold, and I'll show you what the arguments are, threshold is 0.01, you can definitely change that. And the threshold is actually used in the, essentially in the label that you get afterwards. So for instance, we use the threshold of 0.1. See, these are all values which are less than 0.1. Yeah. And it seems sort of thing for large values as well. There's a complimentary function called sub large vowels. You just say, sorry, and I'll just look at the help for that. Just wait. This is actually not covered in the workshop, but it's good to see that it's here. And red samples here would show that very large values you can like create like a separate label just for those. And again, it works with threshold. Okay. So I hope that helps, even though it's not exactly covered here. Yeah. Okay. Explain your, oh that. Yeah, that's further up isn't it? Okay. That's like a small detail. It's a little trick you can use to like get groups of five. You can even do with 10. I always forget how it works. So it's really hard to explain, but it does work. So if you did this, it would be every decade. Oh, maybe not. What'd I do? Oh yeah. Okay. Yeah. Cause the way I filtered it. Okay. But you could do that. You could use this as long as you have like the values in there. Yeah. Cause I did that. Not available. So let's try this again. Or I'll just remove this. 10. So a little trick, not really GT specific, but it's nice little thing. You can get decades by using this modulus without really explaining the math too much. That's how it works. And some of us actually explained it. Okay. Great. So can GTs for my functions apply labels from scales label? Not really, but they kind of do all that they do, maybe end more, I would say. Like you could do things like currency, all sorts of deed formatting and without using the scale functions, which I hope is better, maybe it's less confusing. And you do get more options. And I think it covers pretty much all the different scale like label underscore functions, like label dollar, that's basically a format currency. And I'll show you that in a second. Okay. So let's get past this. Okay. So one thing I'm gonna show you is, say you want numbers in a different locale, you can totally do that. Locale just means you're in a different region and you have different locale preferences. So in this case, yeah. In France or the FR locale, we have instead of commas for grouping separators, it's a thin space, the decimals of comma. We can do, I don't know, let's try DE. Now we'll do this period for a group separators. There's lots of these. And yeah, there's another one. Basically a space and then a comma. So there's over 500 of these. There's actually a function called info locales. And it's a pretty big table, but once it runs and it'll display here in the viewer, it'll show you which locales are available and how they're formatted. And basically a little bit, how do you actually write the locale? You can sort of see what's available. And this is not just used for numbers, it's also used for things like dates and things like numbers are spelled out or index values. It's used in a lot of functions here. Okay. So let's go past this, format integer. Okay, I wanted to show you this because there may be lots of cases where you have decimals equals zero. In that case, you just want to format as integers. Well, there's a function for that. It's got a less complicated set of arguments because you have to deal with like decimal signs. But yeah, basically anytime you need to just format an integer, you can use this one instead of format number. So there is simplified, it does rounding as well. If you have decimal numbers and you want them to be as integers, it will do the rounding for you. Okay, as scientific notation. So we have that in here as well. Let me show you that. So you can target any column which is numeric. Let's do thumb for instance. I'm just gonna take this away because we already know how to use rows, basically expression or some row indices. I'm just gonna show you that this works on the entire column of num. And there you go. So basically it looks like this by default. It's got this part right here, which is the n part. Then here's the n part of the notation. It has like multiplication sign. If something is to the power of zero, it won't show that it just give you the number as a convention. And if you need it, there's also another function called format engineering. Similar sort of thing, except it uses groups of three in the exponent. If you know what it is, you need it. If you don't, then don't worry about it. Just a different way of different rules for expressing the exponent and then to support. And if you want to, you can also use exponent style. You can use things like E if you wanted to go back to that way of expressing scientific notation. And you can also do things like or sign in the m, the n part, you can say true. And anything that's positive or zero will just be shown as a plus sign. So things will line up and you might just need it that way. Okay, so that's scientific notation and engineering notation and percents. Okay, so that's a common thing. We assume coming in just like in Excel that the values are fractional values. We use percentage, the form of percent. So let's take this data set right here called pizza place. We'll do some stuff to it and we'll generate this table. This is before formatting, but we have this column here called rack of quota. So this could be construed as a percent value. So let's do that. We'll use that column. We'll say decimals is one after decimal place, decimal sign and there we are. So we have that. So say for instance, your values are already as like this, like you already have a hundred point eight. What you can do is there's an option here called scale values, false. So if your values are already in percent, like, you know, they're already scaled, you can use that like this. Of course that's wrong here, but there might be a case where it's already scaled 2% values. Okay, and all the other arguments in the function just contain stuff that is in format number, like the usual stuff, like if you want the counting notation or dropping the trailing zeros, so on and so forth. Okay, currency. Maybe got to deal with like currency values. So it's quite a bit in here. That's a little bit different than format number, but not too much different. The main thing is like a currency code. So here the default is USD, but we can choose that. Say for instance, we have this table right here and we have a currency column. Let's just use that and we want the currency to be in your euros. So it's a three-letter currency code. And as we do that, it just does the right thing. It attaches the right currency sign. It also uses the right number of decimal places because some currencies have two, some have three, sometimes rarely if it's four. So you can totally do that. And there's a handy-dandy function called info currencies. It shows you all the currency names and the currency codes against another big table. And so I'm just going to step it away. And the great thing is you can sort of get a preview of the different currency values as they're formatted with the same value. So the codes are all here. Okay, just to show you a bit more and just use a little practice. These are two more currency codes you can use. Two separate columns. I'll just run this. Nothing too surprising here. Two different columns, two different types of currencies. I guess I just wanted to press on you that here, there's actually nothing past the decimal sign. So it doesn't show it. It's just not there with that currency. Great. Okay, so let's move on to formatting of dates. And that has a function called format underscore date. So in that function, we try to make things a little bit easy for you. We have a number of canned like date styles. And I'll show them to you right now. Use info, all these info functions, but info date style is one of them. And what it does is it shows you, yeah, with this name, it gives you this type of date. Okay, and there's quite a few of them here. It's actually a lot of them. But hopefully one of these is good for you. If not, there's a function for that where you can make a custom date. It's no problem. That's format date time. But at any rate, this might cover a lot of use cases like a lot of what you need. So you just use one of these. And it's pretty interesting because like the date coming in could be the character, like an ISO formatted date or it could be like an actual date object. So things like that. Okay, so let's actually try it with Exible again because it seems to have everything we need. So we have this date column and these are string dates. So basically these are character values and they're just in the right sort of format, year, month and date. That's what I have here. Okay, so we use this and using all these keywords that was in that information table, we will get those formatted in the right way. So let's look back over to the left. So yeah, those values which are ISO dates are now formatted with month, day, year. This is just like a label for that. Flexible. Ooh, okay, I'm glad you asked that. Okay, so what's flexible? Kind of weird notation. Let's go back to the viewer, back one. Okay, so a number of these have a little flexible label on them. Okay, and they have like little strange sort of like names. These were taken from the URLs. There's a thing called the CLDR which is the common locale data resource or data repository, I think it is. It allows for localization in different things. So say for instance, we had this right, trying to find a good one here. This one's a very common one. So this code. Okay, so let's actually use that here. Okay, great. So it gives us this. Okay, but the cool thing is we have a locale and we choose one that's different. It will change elements around to be flexible for the locale. It will put in the right language, of course, but it'll actually put in the right format for this. This is kind of like almost like a type or a classification of a date that contains these elements, but the elements themselves can move around that where it makes sense for the locale. So we're gonna have this, that's gonna be different. We're gonna have, say for instance, sorry, I can't see the type. There we go, this. That's gonna be different as well. There's really all sorts of these. Basically these locales, there's plenty of them. And the ones that are flexible means that these elements will change. Like you may have like the, like for instance here, we have the day of the week first, then the day number. But in some of them, they might be like the month first, you know, things like that. So that's what these flexible ones mean. If you just use your, for instance, like this one here, if we change the locale, it'll be maybe a bit nonsensical to the locale. It might work well for an English, but may not be so good for other ones. So that's what flexible means. Okay, I'll keep going. And inputting style is your friend here. That's where you get all these different styles, including these ones which are flexible, should be those. Okay, so let's do another one here, another example. This one's a bit more complicated because we have to do a little bit of, you know, formatting or getting into dates to do this comparison. But once you get past this strangeness, we have, you know, essentially the day column, it can be split between two different types of format. That's, so we sort of see here, this is one type of formatting in the first two rows. And then it changes here. After a certain threshold date, April 1st. Okay, great, times. So you see you have times and they're just in the format hour, sorry, hour, minute, second. You can take those string times and format those in different ways. We got a separate set of styles for that. It's info time style is where you find them. There's much less of those, but they also have flexible formats in case you run to localization. And they also, you know, feature things like, you know, like time parts, like, you know, in the afternoon, little phrases like that, which will be localized in different languages. It's pretty interesting, but you might not need much of that if you might have just a simple need of, you know, times with the AMPM indicator or 24 hour time. Okay, so let's show a few of those. So we have this table here. We're just selecting the date and time columns. And of course, we would just want to focus on the time column. So columns time. We grab this one right here. It's a third one on this table, HMSP. So just basically hours, minutes, seconds, and then the AMPM indicator on the right. And these are till ignored as with all formatting functions. Great. Okay, one more example. This is kind of like the previous example. I'm not going to explain it. Basically just based on rows, you do different formatting, just proving again and again that it works. Okay, for my date time, that one, this one's a bit of a beast compared to the first two because in addition to like matching together at this time and time style, you know, and, you know, putting together with a separator that we're choosing, you can also include a format, which bypasses all this stuff, the detail and time style. And you're basically exactly specifying what you want. This is very complicated stuff in terms of like what I can say in like one or two minutes, but the documentation is there, format, date, time. I'm more likely to want to show you what's possible rather than showing you everything. But if you use format, you have the option to use a date time formatting string and let me go down to what that means. So that could be one of these things where you use a CL or DR type of formatting, which might be in YouTube because it's not very common. But it's extremely flexible and it allows for almost any type of date time to be put together. Okay. And it's going past all that stuff and clean times on support. It's going past that. We also have like STRP time, that time, which is more common, commonly used in R especially, where you have all these different time parts, time pieces and they're, you know, used with percent signs. So you can use that here as well. Okay. So lots of options here. Let me just show you one example. And basically, it's a very simple example where you have a date style, you have a time style and you put things together. So we have here, it basically puts a date first to the time. We could use a separator like so and put a slash in between or maybe something more useful like at and change things up that way. But just, this is just my easy composite with templates, change things, formats. We could use this right now because we do have examples. So let's try one here at the top. There's so many of them. The right here is good. Okay. So let's try this one right here. Yeah. So that does the thing we need. Basically these commas here, anything that is not like these repeating letters are literals like spaces. Say for instance, you want to move the day. There we go. Now it's gone. Do things like this. And it's stuff like removing numbers of letters, changes, things. Yeah. So on the documentation, it's pretty complex but the whole idea is I can do wherever you really want. It's totally possible. Okay. So let's move on to the another function called format markdown. So you have a very text heavy table which is what you might have here in this example. You get a number of pieces of markdown text and then we use the triple function to arrange them and make a GT table. Okay. I'll show you the whole thing. Well, beforehand it's like this. Just large pieces of text which are markdown. You just run a markdown. I'm using this just to make it a little bit easier to see. You see that the markdown is honored and you use all different types of markdown like lists, links, even images. It's totally fine. Okay. So we saw a lot of NA cells in our tables before but we can deal with those and put something else in. So if you don't wanna see NA everywhere in our publishing tables, we can use sub missing. So we're since here, we have this table and we see each of these columns has an NA. Well, almost every single column has this. NA, NA, everywhere you see any. Okay. We can try to get certain columns or all columns and just provide a bit of missing text. So in this case, I'm being original and just calling it missing. And then, so everything in columns, num and char are gonna be missing. All the other columns that I'm using minus num and char that means everything else will be nothing, that bit of text. So luckily these are side by side. You can see missing here twice. And then across we see a lot of nothing. Okay. And so you do things like have two hyphens as well and then that become like an end dash. If you had three hyphens, that would be a longer dash, the M dash, it also use a single hyphen that it's just a hyphen. Yeah. So there's a few shortcuts there for little things like that. Great. Any questions at all about, feel free to ask anything about these formatting functions. There's even more than this. Go to packages, GT, go to format. There's quite a few more. I mean, these are the major ones, but the help is pretty good in that there are examples for all these. Okay. Let's move on to the data color function. And this one is pretty complex. Lots of arguments. More than just this, I don't know why this is not updated, but there's actually more than that. So let's actually go to help to get it. There we are. Okay. A lot more than that. Let's actually update this. Great. Okay. So that's the way it is. Okay. Even though there's lots of arguments here, we don't need to use nearly this many. We can actually get away with just using a few. So what this function does is allows you to, based on the data values, provide color inside of yourselves. It's pretty much what it is. So let's actually use this function on this table right here. So we have this table of different population values from Mongolia from years 2012 up to 2021. Yeah, we got these values. Okay. So we're gonna color the backgrounds of the population column. So that's what we're doing here, targeting that column. Reason in the numeric method. So we're gonna base the color based on the numbers in there. And we're gonna have a palette. So what this means is we're gonna start at red, then orange, then green, then blue. We can have less colors. We have more colors to add to you. We can even take colors from other places like various like, you know, palettes which are built into the package. But we're using this for now because we can specify anything we want and play around with it a bit. And we're saying that the beginning of the range, which is the domain right here, which is at say 2 million. You look up to 4 million at the end of the range and we should expect red to start at 2 million and blue to end or start, I guess you could say, at 4 million. Okay. So let's actually take a look at this and we'll be able to better explain it. Okay. Okay. We can sort of see it. We don't really see red because we're pretty far away from 2 million. We're already at 2.7 million or 2.8 million at that point. And we're not really getting close to blue here. Yeah. Yeah. Yeah. These are basically the switch points. Yeah, exactly. So these are like, this is like, if you've ever seen like a color, if you've ever used anything that's like paint for instance, you'll know what this is. It's just weird to see it in text form. Essentially, these are the extremes and these are like in the middle, sort of evenly spaced. Okay. If we didn't have a domain, then we definitely see red and we see blue because null, which is a default, means that the domain is the range of the data. Okay. So it's actually from that. Okay. Yeah. So we definitely see red here. We definitely see blue there because blue is exactly at the end of the data. And we sort of see in the middle. So we can definitely, you know, we can cut these out like this. We can use keywords as well for certain things. We have veritas. We'll put it inside C. Yeah. So that'll work in there. And we can do things like we could do, so many things you can do. So it's really hard to like get hold of them. We can reverse the palette. Oh, I see, I see it. Okay. Do a comment. There we are. Okay. So versus the palette and there's many more things you can do. It's rather big in terms of what you could do. But the great thing is we do have examples that try to like cover a lot of the use cases. And the texture does tell you which types of palettes can use our color, our color brewer palettes. You just got to provide one of these. Let's do that right now. So that's like, I never know what these mean to me. They means brown and blue green, I think. Yeah, that makes sense. Okay. So we can definitely use these. We can also use these veritas palettes. We can also use palettes from palettes here. It's another package. We've got a function here to view all the different palettes. It's quite a few. So there's definitely no lack of palette opportunities in this function. We can even use this function without a palette. It just uses the default palette, which is not that great, but it's there in case you forget to have that argument filled in. So you can try to run this function without any arguments and it'll still work. It'll be great, but it'll still work. Yeah, it's better to run other arguments, like at least a palette and a method. Okay, so what I'm more impressed upon you is that there's lots of options in here. I won't be able to go through many of them at all, but there's lots of examples in a package. You can color other columns. You can color all columns. You can take a color ramp from like one column and apply it to all columns or selected columns. You can do things like do the coloring instead of down across sort of using the argument direction equals row. That means you can color from like this row to the end instead of like top to bottom. Yeah, so I totally suggest if you like this sort of thing to just run these examples, ease enough to do, and kind of find a way to sort of play around with all the different options. Okay, I'll run one more example here. Using the piece of place table set, I'm gonna make a small table here. Okay, I just wanna demo that you could use like this notation right here. Color package name, then two colons, and then a palette from that package. And then this should work. Yeah, and then, sorry, I see the question here. So yeah, definitely the color of the foreground text will change with the palette. And that is, you can also do there's many more things you can do. And I do forget the option, but there is, I believe it's called apply to it. Yeah, this is right here, text. So let's see if this works. Yeah, so another way you can do it, you can do it in a way where the text itself is colored, which may or may not be good because you have to set it back around sometimes. So, but if you set the right palette, that might be what you need as well. By any rate, you can use this sort of syntax. And if you use the function called info palette here and run that, you'll get a pretty large list of different color palettes and you'll actually see the different colors. And so, for instance, you can use dichromat right here and then just choose one of these palettes for instance, dark red to blue 12, and then run that and it does use those colors inside there. Okay, so lots of options for colors. Yeah, okay, so that's data color. Okay, color within a subgroup. Interesting, so do you mean like within? Yes, you can, sort of, you can use rows. So we can say like one to three, yeah, not bad. Or we can use other types of rows. Let's do, see this works L and M. Okay, yeah, so L and M, oh, strange, okay. So not so good because these are not unique all the way down. Okay, so if you have a stub, we do have a stub, but these are not unique. So if they were unique, then we'd be able to do that. And unfortunately there's no groups argument in here. So if you had row groups, you can constrain it to a group, but that might be a good idea for the future. But these could do rows and indices and other ways of targeting, great. Okay, so let's move on to the next function which is text transform. Okay, so I mentioned a while back that you can use formatting functions and one of a number of sub functions. There's quite a few of them here. They let you handle things that for matters miss or don't really handle. And there's a number of text functions. And we're gonna look at text transform. There's also text replace, text case when, text match. But the idea here is that you have something it's totally done, it's converted to a string and you're gonna supply your own function and change those strings in the end. It's kind of like the last type of formatting you can do. Okay, so what the function takes is some location and the default is cells body, we can change that. And then it takes a function, okay. So the key thing is the function takes an X. So you write it like this, and then you do something with X. And X will be the strings coming in. So let me demonstrate bit by bit, okay. So we have this table we made here. And then what we did was we formatted the currency values. Anything that's a number became currencies. Okay, really there's nothing to do with anything else, but okay, and text transform. What we wanna do now is, we wanna say date. We wanna put a bit of text in front of it. We could have done it some other way with a pattern, but we declined to do that for a sake of example. But what we wanna do is we wanna take an X and X in this case will be each of these strings right here. And we're gonna do something with it inside the body of the function. In this case, you just wanna paste date colon space to each value of X. Okay, so let's do that, great. Yeah, and this function we can use any number of Xs, any number of times. And we can pull in things from outside the function call. You know, any objects you make could be used inside here. So it's pretty flexible and it's kind of neat that you can just do this to the text. And then yeah, basically we constrained it to the columns, the values inside the date column in the body of the table. That's what this locations does. Great, so that's really the easy extent of text transform. You can do some really creative things with it because you can take anything in and output anything out and it goes into the cells. Okay, so in summary, what we did is we covered all the formatting functions. You know, once it involves numbers and once it involves dates front part down as well. We were able to handle missing values with submissing. Data color was used to color some cells according to their values. And we did a few info functions to provide information that supports some of these formatters. Things like little cows and date and time formats. Okay, so that's it for this module. Let's go on to the next one quickly for the top of the hour. This one's a bit shorter for matters. Takes a long time because it's so much there and it's so essential. This one is a bit more structural in purpose. This one deals with doing anything with columns and they all start with calls underscore. So you can do things like alignment of values and columns, hiding the columns from view, changing the column labels, moving them around and even creating like spanners based on the column names. Although that one's not being used in this module. Okay, so let's look at a few of these. Calls align, we looked at that before. It really is a matter of like taking a table like this and just changing the line of one or more columns. In this case, population is now left aligned. It's a little bit hard to see in a small table but it's left aligned. Great, so you can do that with any columns. You can do with all columns if you want. Calls label, this is one of the really important functions because most of the time when you get a table it's not very satisfying in terms of the labels. You know, usually they contain things like underscores or all lowercase, you might wanna make proper labels out of them. So you can do that, you can do that with this call table. So you put the column name on the left and the new label on the right. And by default, the labels are the column names but this is just changing the labels of the columns. Okay, yeah, so this case country name becomes name and these become capitalized. Tell the case. Okay, let's do it again. Doing something a little bit special here in that we're taking a table, we wanna use markdown labels. We don't wanna put MD around each of these, we could but we also have an argument instead of call table we're gonna apply any function to all these labels and it's called .fn and we're just using MD there, the function name. In that case, it just applies the MD function to each of these labels. Great. Great. Tables labels from labeled, what do you recognize that? It does, it does. I think I even have some of that stuff. Okay, let's see here, what do I call it? The assets are X. Yeah, here we go. So this is the asset and it pulls down. So it actually has labels. It's kind of funny, it doesn't show it there. But anyways, let's actually take this and pipe in the GT and we'll take a look at it in the viewer. It's kind of a big table. But yeah, it doesn't show them here at all but these are actually the labels, the label attribute of each of the columns. Yeah, and that's sort of a new thing, the GT will accept that. And labels is a great package to make that happen. Okay. Okay, so calls width. So that's where you set the widths of columns. And by default, the GT will do is we'll just take up the right amount of space, it'll just sort of break columns or size them according to the content. But you can sort of take it into your own hands and use calls width and set the widths of each column. And you can do all of them if you want to. And you can also use select helpers like this. The key thing is that you put a tilde on one or each side between each of these. To make two-sided formulas. Let me show you the help for this. Okay, that's basically it. There's one example in here and it's basically this example. But yeah, you would use pixels. You can also use percent, a little more hard to deal with unless you make them add up. Even if they don't add up to a hundred, they just get normalized. So it's more like you're just making guesses or approximates really. Pixels is nice though, because you can definitely control it. And if you do every column in pixels, it's quite accurate so you can make them really small or very large. So what I'm doing here is, have these columns here. Anything that ends with R, which will be what starts with ends with R is char. So that'll be like that column. Num is going to be 150 pixels. These two columns, they will start with date. They'll be 200 pixels wide. Everything else will be 60 pixels. So we can see the date. Date time columns are pretty wide. Char is not so wide. It's a little hard to tell, there's no line there, but yeah, it's sort of surmise that it is small. And num is a sort of in the middle. And everything is, everything else, which is row is quite small. We can even make it much smaller. So the row that actually the content goes off the actual size, sort of overflows, which is kind of because sometimes you do want this small for weird reasons. Like you just want to put a color in there with no text, you can change the size to be something super small or super large. Okay, I just got a question. Can mines be added? Yes. Between columns. Also yes. Okay. Yeah, definitely you can do that. So you can do, that's what you try right now. So you can do a tab style. And let's just use style, sell orders. I do right, sell orders, okay. Sides all, that's a great default. Let's do weight equals pixel. So we can really see it three. We have a style, but we need locations. We'll do a cells body, like a whole thing there. Let's run this. Yeah. And now we added on all sides, sell orders. Maybe you don't want that. Maybe just my sides. I believe it's left, right. Now it's just the left and right sides. And of course you can omit those just by targeting these columns. So you can definitely do that. Yeah. Do the columns. It's like case, win. Yes, that's exactly right. Yeah. First case. And then I think it's a little bit different because everything is kind of like weird. It's not replacing everything. It's actually saying everything else. That's kind of a weird thing. I think we'll, but the rules are a little bit different, but pretty similar and stuffly order based. It just the only thing, the only thing that's strange is everything, which just means, means to say everything else. Yeah. The thing is like true. Yeah. It's kind of a mistake in here. Yeah. That should more or less be true or should be what they're using in case, when now, which is something entirely else, I believe. I think it's like default. Yeah. Yeah. This may change, but it will still be backward compatible. Yeah, default is the best. Okay. So now we're going to go to do a few more of these calls functions. Calls move will be one of them. And this is pretty much just moving columns into place. There's actually a few variations of this function. There's calls move, calls move to end and calls move to start. These are very specific. This one's more general. I'm going to show you the more general one. Okay. So let's start with this table right here. Okay. The simple table we've seen this many times before, but in this case, we want the population column to be after a country name. So we're going to move it left one position. Okay. So we can do that. Notice that here, we're selecting column names without quotes. We can use quotes, quotes. Totally fine. GT accepts that. Yeah. Just wanting like lots of ways to select things, which is a bit confusing, but also maybe a bit nice in the end. Yeah, same result. And one more dangerous thing you can do is use column indices while we're getting into that. Same sort of thing. Yeah, but not quite as great because it can be confusing. Great. Okay. Calls hide. So this is great for those cases where you want to use columns for data, like say for conditionally, targeting something or altering something. See, for instance, using the column data for something, but you don't actually want to show that column data in the end. You just want to not show it. You can hide it. It doesn't matter when you hide the column, it'll still be used during the API to do the things you want to do. It just in the very end is not displayed. Okay. So we can use calls hide for that. Okay, so let me show you. Okay. So we've got this. Country codes are a bit redundant. We may have used them for something. We didn't really in this case, but see, we did. We can just get rid of the calls hide. Okay. Interesting thing is, if you have this and you decide to put footnotes on some of these cells, which are going to be hidden, you won't be punished for that. They'll be renumbered, essentially. They'll be like, you didn't do it at all. Okay. So you can definitely like flexibly hide things without, you know, serious repercussions. Okay. This is the case where we actually do that thing where we actually take data and we do hide the data in the end. Okay. So we have this table here again. And this is showing you that it could be in your order. We're going to hide the country code three in the population column. Okay. Okay. So if it's been a little longer there on the final table. But in tab footnote, we're actually using the population column. Right? Right. And we're going to place a footnote in the years column. Yeah. These three years. Okay. So that population column is not there, but it's still used. Okay. Advantage over using the bar selects. No, I don't think so. I mean, there's lots of ways to do it. Sometimes it's just how you feel. It's, there's no advantage you could do if you want to make columns, you could do this. You could do things like this. It's a, it's basically, I think there's no advantage or disadvantage or whatever it's easiest to you at the time, I suppose we're readable for everybody else. One more thing I want to show you. There's a, yeah. There's another argument in tab footnote called placement. What tab footnote tries to do is not break off the alignment of columns. In this case, years, we don't really care about the alignment. There's just years. So by default, GT will do this. It will try to place footnotes where the line is not, you know, not affected, but we don't really care in this case. So we can automatically, we can manually adjust the placement of the footnote mark right there. Okay. It's a little trick from a long time ago. This whole thing about placing numerical footnotes to the left of numbers. It's actually pretty old, but not often seen, but once you do see it, it's actually pretty good because it does serve a purpose. Okay. So now we have a number of calls merge functions. There's a number of them here. Let me show you what there are, calls merge. Okay. We actually have four. So three very specific, one general. And what it does is it takes values from adjacent columns and then puts them together into one column. Usually it's the first mentioned column in the calls merge case, but for these other ones, it's definitely the first column. Okay. So if you say it's that first column and it automatically drops the adjacent columns like the secondary column, because that's usually what you want. You know, you don't want to repeat information. Okay. So let's try this whole thing, this whole merging operation thing with calls merge range. So it operates in two columns. Let's take a look at the table beforehand. Okay. So the table here, model, mpgc, mpgh. We want to merge these together as a range. So it has a range separator that uses automatically. All you need to do is specify the two columns. So it'll be merged on this mpgc column. Okay. So let's take a look at that. Great. So that mpgh column went away, but the value got merged into this column. You could keep that column with auto height equals false, but that's a, not a thing you often want to do, but you never know. And one thing you do want to do usually is change the column label. So in this case, we'll change it to something that is more meaningful because the value is remutated. Okay. mpg now, so mpgc. Okay. So that's calls merge range. We can use another one, which is specialized calls merge insert, merge two columns to a value plus and uncertainty column. In this case, we have a way of formatting it, plus or minus, this gets transformed into something that looks a bit better depending on the output format, but it's pretty much the same thing. The first column is the value, second column is the uncertainty, which is plus or minus. You get this in the end. Okay. So let's run this up to the formatting part. Great. Okay. So it's a little strange that we're using these values. It doesn't really matter. We're just pretending that this is what you want, but we can format these separately like this. You can do the same thing to the currency column. And then those format values will be merged. Right. So you can separately format like the value and the uncertainty either before or after. It doesn't matter what you do it in. So you can have two format numbers and do the right thing for both versions. Okay. And then of course we can change the label to make that, make more sense. There we go. And a few more things. If there's any value in the uncertainty part, it's not shown. If there's any value and the value or both, nothing is shown. It's just NA. Okay. So some rules for handling NA's in this function, which is pretty useful to have. Another one, I'm gonna show you one more, maybe two more. Yeah, two more. Calls merge and percent. This is a mistake. Essentially what you have here is a call N and a call percent. And you get this in the end. A number integer number and some percentage. So this is where formatting is very useful in two separate columns. You might wanna do format integer for this column, format percent for this column and then merge them together and then you get this. Okay. So this actually demonstrates that right here. Okay. So we'll take pizza place once more. Let's go to the part where we do the formatting and we get a table. So it's a very big table. Okay. So you can sort of see here we have an N value. We have a fractional or a percent value here. These should be merged together. Okay, we can do that. Let's run the whole thing. Yeah. Okay, we're definitely using more statements here, but you can sort of see very quickly, just a few more statements makes the table look a bit nicer. We have things like line breaks and units here. Things formatted differently, but the key thing here is that we get the number and the percentage in parentheses. Okay. And if you really want to do your own thing, generate your own type of merging, you can use the general calls merge function. What that does is, well, you actually have more than just one column in columns you can actually have three, four, five. It's totally up to you. The first one mentioned though will be the one column that's mutated on where everything is basically where all the merging happens, where the final value is placed. And then you have this statement here, high columns. This just means that anything aside from the first column will be automatically hidden with this. This could be null if you don't want that to happen, that sort of thing. And then also we can such rows from those columns to limit the merging. Okay, we're running a little bit low on time. So I'm gonna be a little bit quick about this because we're at the end anyways. So we're here, we're gonna have this table right here. Okay, we're gonna merge pairs of columns, open and close when merged together. This will be the pattern. And then low and high when merged together. This will be the pattern. So I'm gonna show you that rows works. That's why I did this here. It's kind of strange, but I'm doing it here. And then we're changing the column labels. Okay, so we can sort of see that right here. If we get this pattern where it's merged, it's limited here by the rows that were selected, one to three, but we do see that. We don't have those extra columns, where you see like 2018, 94, that column is gone. Same with the high column that was gone. Okay, so that brings me to the end of this module. And we do, the remaining two modules are pretty short. So we can actually just take a little bit of a break. Maybe a five could be like, we'll go to like 10 minutes after the hour because we can work in this practice RMD. You just have a look at it or you can just ask me questions, tell it to you or you can just take a break. Yeah, and I will just put myself on mute. And if there's any questions coming through, I'll definitely answer those. Well, that's a really good question about the chat being saved. Usually this stuff sort of disappears, but I would like to save it and put it somewhere, maybe in the repository. How do I even do that? I know it's a place where you can do that. Okay, so this will be the, yeah, there we go, there we go, there we go, okay. I can do that now just in case I forget at the end. Oh, excellent. Okay, this is good. I'll just again, as well. Perfect. So remind me. Yeah, I suppose everybody can, which is great. Okay, that's perfect. I can do the same thing too and store it somewhere. Oh, update, fantastic. Okay, I will give that a try. Okay, save chat, join finder. Yeah, I believe that's it. Should be the same one. Yeah, yep, I did update in this one file. Brilliant. Okay, I'll keep that there. Okay, we might go another two minutes to the end of the break. Hey, I mean, that was a bit of a break. We don't have to go to the 10 after, I don't think. We've got a bit left to do. This module will be pretty short. It only involves two functions, albeit they are summary functions that have a lot of options in it and a lot of ways you can use it. So I'll take a little bit longer, but not that long. And these table option functions, which there are quite a few of them, but they're very simple to use. So all the tough stuff was essentially in the first half of the workshop. This is more or less, you know, like easier stuff, easier material to grasp, I think. Okay, we'll see. So summary rows. So GT often doesn't create new data for you. It's not really great at that, although it does create summary rows or aggregate rows. And this is good because it's really difficult actually to create summary rows and package them up in your table and then identify to GT, these are actually summary rows. I mean, it can be done, but it's not incredibly easy. So GT tries to make that a bit easier for you by letting you specify or generate those rows and put them in the groups or at the bottom of the table. So to that end, there's actually two functions, summary rows and grand summary rows. So summary rows is group-wise summary rows. So if you have groups, then you can use this function. It'll create different summary rows per group. If you don't have any groups at all or you want to disregard the groups, you can have both sets, you can use grand summary rows. So you can have a table, which is grouped and has row groups, use both or one, one or the other. Or if you had no row groups at all, you would just have to use grand summary rows if you want to have aggregates at the bottom. Okay, so let's deal with the group-wise situation first. So summary rows. So what you do there is, again, you would have to have groups. So this is like the table in its grouped state. If group A and group B, and we specify which groups we want to have the summary rows generated for. We can also specify which columns we want to apply these aggregate functions to. Okay, and then the functions themselves, they can be one function or a list of functions. Usually they're wrapped up in a list like this. And there's actually a number of ways to sort of like present this. I think this might be the easiest way to improve the label equals, and then the one type formula. Okay, and there's a number of other ways. So again, like later on, definitely look at the help. And it'll show different ways of expressing the way you express functions. It's quite a few ways. It depends if you want to have the ID different than the label, the ID is important if you want to style it later, things like that. Okay, so there's a number of different ways. And there's a few examples that show it. Okay, so this is one way of doing it. And we want to apply the summary rows across both groups here. So let's actually run this. It looks like, okay, so we're generating one row because we only have one item inside the list. And this is the function we're using. Recalling its sum, label a sum, the ID is also sum and the function we're using for it is sum. The dot is all the values in the columns. In this case, it's only num. Everything else is given like these m dashes which could be changed with missing text. You could just have a space or empty string. For instance, I'll read on this. Here we go, now it's more or less empty. Yeah, and we can have multiple of these rows. We just have to separate them by commas. We can have like min equals min dot. And then we can use any dot or m to be safe. Okay, and now we have two rows for both groups. Scroll down a bit to see it. Though it doesn't make it easy, does it? There we are. Great, so that's what this does. Okay, it's very simple and doesn't look great because these are not formatted, but they can be. So I'll show you that next. So let's have this table. Okay, that's our starting point. Two groups. And we actually don't even have to include groups. If you exclude it, it just means all groups. Okay, because the default is everything. Okay, but we're still gonna constrain to like num in this case, in terms of like what columns that are gonna get will occur on. This case, we'll have a number, we'll have three rows. We have three lines here, three rows will be generated for each group. In this case, all the formatting will be done to the new values with this value in the format argument. So we use format number. This will stand for the values to be formatted and these are the arguments in the format number function. Okay. So we'll run that. This is quite nice. Now the values are new values and they're formatted now. And they're formatted in the same way as before at the num column, right? Yeah, because when you apply a format or it doesn't actually go into the summary cells, it's all the values in the body cells only. Okay, so that's how you make summaries, number of different rows and how you format them right away as they come in. Okay. This is a case where we actually create summary rows twice. Let me just show you that and we're formatting it differently each time. Okay. So let's go up to here. There we go. So in this case, we're creating three summary rows. Great. But the interesting thing is that we could run it again and what happens is that it'll reuse the same rows as long as you give it the same IDs inside the list, right? It won't make new rows with some mid-max. It'll just reuse the same rows. And you can apply totally different functions. You can use different columns. You can basically run it again. It'll just be additive. And you can do different things like change the missing text to be different. So let's quickly, so let's run this whole thing. Yeah. So in this case, let's move this right here. There we go. Sorry, that was a mistake there. That should not be true. But now what we have here is we have this being filled in. So currency, it's got its own aggregations. These could be different. They can all come by the same rows. These are given by the identifiers right here. But these can be totally different functions that operate on these values. I'm using a different formatter as well. So you can use summary rows multiple times or you can use it just once. It depends how complex your summarization needs to be across the table. And of course we do things like we can limit the summary rows to different groups. Say group B just for this case. Okay, so we move this over here. Let's hold thing again. Okay. So in this case, if you scroll down, group B has both sets of aggregates. And in group A only got the first set because it was excluded in the second call. Yeah, I got a question. When will this recording be available? I believe we got an answer way back. But I don't recall what it was. So if anybody knows what that was, you can scroll back. But June 23rd, yeah. Okay. So grand summary rows. So that is rows that take into account all the data across the groups. Yeah. So grand summary rows is what you use. It has a very similar function, except it doesn't have the group's argument because it doesn't consider groups. So it's basically just like all the data in a table. So it's actually run this table up to the point where we would run grand summary rows to create those summary rows. Okay, so it appears here. Okay, we have two groups. And if you run grand summary rows, it's kind of nice because it cuts across the groups. It considers all the data regardless of a group that the data is in. So we see here min is this value. Max will be, well, something in this group, I think. I don't really see it. Oh, 63, yeah. It's up here. So we sort of see just from this little check that the group membership doesn't matter for these. The grand summary just considers all the data. So the min, max, and average. And like I said before, you can combine group summary rows and these grand summary rows together in interesting ways. The example I want, the example mean low CI, high CI, I'm unique. Yeah, that can be done too. You would just change your function to include like a paste, I think. Although, unfortunately I don't have an example here of that. But you can do some pretty complex things with your own custom function as well. I actually think it does an example for that in one of the articles in the package where we have something that's like a range and it has like two values, but it's part of the aggregate. Yeah, take a look at the gt.rsteo.com website in one of the articles. I think it's the GT cars one that has that, although I can't, or I think, no, it's the one that has to do with summary rows, which does make sense. Okay, so that is actually it for summary rows. Two ways to add rows. There's actually a new function in the package called add rows or rows add. It's not actually available in 0.9. It's actually in the dev version of the package. But if you need to add arbitrary rows, this is a way of doing it as well. But you need to install through dev tools, install GitHub to get that. But if you did, for instance, need to add arbitrary rows, you just wanted to throw row in or two. This is actually in the package. And you can do things like include rows, which are empty or just create data from nothing, essentially like the beginning of the table has no data, but you're just adding row at a time. Or you can add to different groups like so. Yeah, so GT is starting to get ways of adding more rows in different ways. And the next thing we'll be adding columns. Okay, so now we're gonna get to the last module in our workshop. And this has entirely to do with all the functions that begin with opt underscore. So these are just like little options that are actually mostly in tab options, that very big function, but they're exposed here just to make it a bit easier and to sometimes set pretty complex mixtures of settings that would be kind of hard to do in tab options. Like, for instance, opt all tasks with one value might set two or three things depending on what you put in there. Okay, so let's take a look at a few of these because what they do is they essentially work on the presentation of the table. Okay, so opt footnote marks. With this, you can modify the set of footnote marks you use, we've seen before that but default their numbers, but they could be letters and that could be set in tab options. But it's also very easy to do here. Let's start with this table here. I'm gonna go right to the very bottom. We have a bunch of footnotes in a table. There you go. So it's a long table, but we see some footnote marks, there's one here and then two is here twice. We can use opt footnote marks and mark SQL standard. And what does is it uses a standard set of marks, which are text-based marks starts with the asterisks and then there's the dagger. If you were to go to the help for opt footnote marks, you could see exactly what each of these little keywords mean. You see here standard symbolic marks for symbols in total, extended, these are more different marks. What happens is if you reach the end of the sequence, you start again a double up on the marks themselves. Yeah, this kind of shows like much the same thing. Okay. So this is just a way to quickly get at different footnote marks. You can do things like letters and that uses AB. You can do also the vector letters and make it capitalized. That also works. This is capitalized letters. Or you can do things like this. I'm just gonna choose a market random, this one. Gotta put in quotes. And maybe for instance, I don't know, pound sign. Let's try that. So if you run that, we only got two of them. So just go, you'll use the percent sign first then the pound sign second. Okay. So it's also a feature in GT to add row striping. Some table packages have this on the default. So make it pretty easy to use, right away as a top level option. This is, this option's in tab options and it's also available here. You either have it true or false. By default, it's not turned on, but we can have it turned on. And there's other options inside tab options to change the color of the stripe as well. Okay. So that should run this. Okay. So it's a little hard to see. That should be very hard to see on some screens. I can barely make it out, but you see this row two has got the stripe, row four, row six and row eight. And like I said, in tab options, sorry, we do have some options for, I think it's data, a little hard to find. It's only because like tab options is pretty huge and I've since forgotten. It's going to be table body, no. These are arranged, row striping. Okay. Row dot striping. Okay. So we can choose that row striping. Back on color, we can choose light blue for instance. Yeah. And at least allows you to change the color of stripes. And if it's like too bright, we can just lighten the color or we can just use adjust luminance. We can use steps, it's two and that might brighten it up a little bit to make it a little bit less dark. Yeah. And we can also go in the negative friction as well. Great. Can you get it to include the row? Oh yeah, okay. Hang on. Let's actually run that again. Okay. There's a question here whether you can get it to color the row names. Yes, definitely you can. So that's actually another option inside tab options. So now I know where they are in row striping. So include stub. That's what you want. True, by default it's false. There you go. And now it's across the whole thing. There's also another option row striping. Might as well share them all. Include table body, include false and then go the opposite direction and just have the row stripes in the stub. There you go. Yeah. Lots of options in here. It's a heavy on options. Okay, opt to line table header. This is a really nice option. I use it all the time to align the table header. Center is nice sometimes. But I like to have it sometimes left aligned like the header. So let me show you the difference between the two different looks. So let's make a table that has sort of a lot of components in it, including the header. Okay, I'll be using this a lot, this table, this sort of like standard table. And then let's use align equals left for opt to line table header. There you go. Analysis to the left of the table, which is kind of nice. Especially if you need that title a bit larger too. Looks pretty good. Okay, another option is opt to all caps. It allows you to set things which are not the table body cells in capital letters. Okay, so again, I'm just gonna run through all the code here as a before and after. So using this, yeah, gives us the column labels, the row, group labels, and all the labels in this tub. Capitalizes them, at least holds them, yeah, in most cases. So we have that. And sometimes you wanna have less lines or more lines in your table. We got a function to quickly set that opt to table lines. And you can do it to different extents, all, none, or the default set of lines. This is great if you just wanna have all the lines and subtract a few at the end. I'm just gonna run the whole thing so you can sort of see what this does. Basically includes all the lines. And then you can do things like subtract lines with some more tab options. Or you could just, you know, work with some of them or change borders. It just allows you to get to a different sort of like degree of like the extent of lines in the table. Okay, same sort of thing with the outline. You can include a table outline as well with one function, opt table outline. Let's run that. It's a little hard to see because it's gray, it's on the edge, but you can change the width to PX, say like five, run it again. And it should be more prominent. And you can also change the color of it too. Let's make it red. Yeah, now you can really see it. We can change the font of the entire table with opt table font. So we just run that. You can also use Google font as well. We've seen it before, but we can also use it for the entire table. This is one from the service. And then we can also specify other fonts in case, you know, you're interested in not working or that's typed in incorrectly. There we go. So that's actually taken from Google fonts and applied here. And we can do the same thing, you know, not with the Google fonts, like our own fonts on our system, say Comic Sans, just to see that it works. As long as you can identify the font name in your, you know, on your computer, then this should work. You just have to use the correct name. Yeah, you do need an internet access for Google font. That's why it's good to have fallbacks like we did here. Say you're passing this table on to somebody or you're in a situation where you don't have internet access. What will happen is if you don't have internet access, you'll use Cochin instead. And then if you don't have that, you'll use Serif. Okay, opt all caps. I think we saw that. Yeah. And if you're like really good with CSS and you wanna make a national table, and you know quite a bit about what style you want and all the style helper functions don't give you what you need. You can take matters with your own hands and use opt CSS and define your own CSS. Okay, so let's create a table here, which has this. Okay. So this is before we use CSS statements. Okay, let's table right here. Let's say you, you know, we have this ID we set to one. We do this because we don't wanna set CSS for other things in the page. So it's a good idea to set the table ID and then use that here. And then we can target different classes of the GT table and then, you know, add different CSS rules for that. Say the background color of sky blue, each row will get padding, you know, top and bottom, left and right. And then, you know, the heading will be centered. Can run that. Okay. Anybody wonder how do you discover any of these things? You can do the thing like right here, inspect element. And then if you look over here, if you get into the table, not that bad to do it in our studio. You can hit this button right here and then target the actual table. Okay, we'll have to sort of zoom in a little bit here. Table, there it is right here. Okay, there we go. So we can click on different things here and then see different parts of the table. Like here's the body. And eventually we'll get to some classes. We'll see GT table body. We'll see things like GT right, GT row. It all begins with GT rather incessantly. And then you can just target those things and you can even do things like if you right click, but I can't seem to do it here. There's a way you can do it so far. You can actually copy the selector. I think it's just a way of doing it here but I've since forgotten. Anyways, you can do things like GT right. For instance, we change background color. Let's see if this works. Yeah, a lot of things are right. Have that class. So basically everything that has that class will get that background color. Okay. So yeah, you can do interesting things if you need to. This is more like in cases where you have say like a shiny application and you want to really change the look in a precise way. This is pretty much it. These are all the important opt underscore functions. And this is actually a lot of the GT package. I mean, there's many more functions in the package but they're less essential than the ones that I discussed today in the workshop. And I feel you have pretty far just with the materials here. And anything else, definitely discoverable in the help. So I want to show you that really quickly before we conclude. So if you go to, for instance, the GT GitHub repository. Okay. So we'll find some links to things we need. So for instance, right here, this is like a pretty good link to get to all the documentation. Another one is the Posit Cloud GT test drive. What that is is kind of like the workshop materials in Posit Cloud. If you click that, which is up here, the button is here, but it's also here and it's also at the very top. If you click that, you'll be taken to a Posit Cloud project. It'll have all the examples in GT, it'll be up to date. And you just basically go through a number of different RMDs and run every example that's in the package, which is more that's available in this workshop. So it might be useful. Alternatively, you can go to the GT website and there are articles there. So I mentioned the summary lines article. It goes into possibly more detail than I did in my workshop because it's one article. But also there's a reference section which has all the functions, they're all grouped into different categories. So you look at all the different formatting functions, you look at all the different substitution functions and you should be able to get clear descriptions of all the arguments and examples with images here. So you can sort of see what each function does. And also you can copy each of these to your RStudio or to your VS Code and run them. So this is a pretty good resource for learning the package as well as the workshop. So totally recommend checking out the GT website. And I think that's it. The last thing I have is just this practice but really is just practicing using the opt functions and that's kind of it. So I'll definitely open up for questions now if you have any. Okay, so is GT been used for literature reviews as in scoping reviews that have a lot of text? Never haven't heard anything about it but maybe somebody else in the chat would know. Okay, yeah, PDF is pretty good. You can definitely use it in R Markdown and in Cordo. You just have to have the output format being PDF import images into cells. Yeah, you can. We actually have a good example of that. So there's a few ways you can do this. But a way I like to do it is with format image function. And what you can do is it's kind of interesting. You could take resources on disk and as long as like the text in your cells has some sort of way to get to that image or has a part of the filing, you could fill in the rest. So here format image, we're saying in this column connect to RER and also in lines. I think it's run twice. Yeah. We have images in this folder, Metro SVG in this package. If you're a run this, that's a path we have. And there's actually files in there. I think you do files list or list files. Clarify things, I hope. Yeah, number of SVG images. You also have PNGs, that's totally fine. And what we have in there is that. But what I said, we gotta run this example. But essentially, we have text in here, which is the X, right? So we have one, for instance, in quotes or as text or we may have like one comma five comma eight, which is what we have in this. And what this does is file pattern does is it matches up those bits of text with file names and inserts the image. So if you have like say like the text image in there or it may be image.png, you don't have to use file pattern. You can just say format image. And as long as image png is in the working directory or in the path you specify, that image should show up. Yeah, so I recommend looking at format underscore image. Another thing you can do is if you're working with remote images, you can use markdown and then use like an image link for that. There's also other ways too. You can do text transform and there's also another function. How's the size of png? You can set the height right here. Yeah, so two M's, which is a pre-reasonable height in a row, you can use any other length units like pixels or what have you. Tables for regression model summaries. For that, on that I would just go to model summary or GT summary for that. Those are both really good. And I think they utilize GT and other table packages. Like you can use flex table with those. It's a nice front end for basically like taking in model results and then making a table in any table package you specify that they support. Yeah, so the GT summary, what you get in the end is a GT table. So you can take that GT summary object and just apply functions from here like styling functions or what have you and continue on with that. I think you have to use something like as GT perhaps, but it's not too difficult or to find that information. Yeah, so the SVG images, they're vector graphics. So they won't be pixelated. So you can zoom in really far and it'll just be super crisp because center the vectors. Yeah, I believe this is just an image of it. But if I were to run this, it would be incredibly sharp like all these little images. All right, these are great questions. Keep them coming if you wanna ask questions. I'll do my best to answer all of them. Thank you so much. Thanks so much. Really great crowd here. Thanks for asking all these questions. Usually in workshops, I don't get that many. Can we replace an input of a vector with a picture? Hmm, maybe if that vector means image files like file names for sure. Even if they're just fragments of a file name and we use that pattern, then definitely yes. Yeah, so you may have to like rename your images to sort of coincide. But then the sky's the limit as long as you have that mapping between the bit of text and it could be comma separated in like one string. It works quite well. You can definitely just, you just have to rename your images compared to officer. I think officer has more support for other types of formats like PPTX and Excel. And also it's better for insertion of tables inside of documents already existing. And I think there might be more things like, because the officer frequently pairs with FlexTable and that's its own table API and it has essentially different options, but it's pretty close. It's pretty close. I think the main thing is you might get better options for other types of formats, mostly PPTX and Excel, which essentially is not supported by GT yet. Yeah, yeah, I think it's in the future. What I'm planning to do is Excel first. That seems to be asked for a lot. And it's not unreasonable to get an Excel table from a GT table. Okay, yeah, I'm hearing that less often PowerPoint, but it does seem pretty important. Another stop gap I wouldn't mind having is better PDF output, like PDF from an image or you can actually essentially use as an image in PowerPoint, but it's not quite the same thing because you don't get the editable table. But because of the work that was done on Word, basically generating OOXML to generate the DocX, PowerPoint and Excel don't seem that far off because they use the same XML format, although they have different arrangements of it for different features of the tech. Yeah, that's handling PDF. So PDF is really two different things. You can create a PDF from an image, which is what you can do a little bit strange because PDF is like a catch all for like anything that's in the PDF format. So you can create a PDF as an image from HTML table in GT or we can create a PDF from LaTeX output in GT. So both are okay. They both work differently. And with GT Save, you could specify like a PDF as an output format. And that PDF is from an image, like an image from an HTML table. And also you can specify a LaTeX output, but the way you normally get LaTeX is like using as LaTeX or using inside a document like Cordo or Armworkdown, which has the LaTeX output format. Okay, any more questions? This might be... Oh, hang on. Okay, there's more. I think there's some table packages which import less than the cells, can GT do this? Oh, plots. Well, GT can do this in a weird sort of roundabout way. You can use ggplot Oh, ggplot image. And there's an example there of how to... I mean, it's not the best way of doing it, but it does give an example. It does seem to work where you can have like a plot inside of a cell and you make that ggplot outside of GT. And also if you need something that's more like Spark lines, you can use GT extras, which is another package. And that lies out of Spark lines and like little histograms. And plus you can do things like using, you can also use Jatter. No, not Jatter. They're a package. The name I forgot, but it allows you to have little histograms as text and you can pop those into a GT cell. What's the name of that package though? Okay, there's lots of ways. You could get it done. You can get it done. Try this example out and see if it works for you. Okay, this may really be it. Thank you all. See, there'll be no questions. I will save the chat and I will leave. Well, I really enjoyed it. Thanks for coming where it was left. And I hope you got a lot of this and yeah, we'll see you soon.