class: inverse, center, middle exclude: true # .big[TIDY] # .huge[.teal[DATA]] --- class: inverse class: # .teal[TIDY] TABLES <img src="../images/tidy_ice_cream.jpg" width="98%"> .smaller[.small[.bottom-right[.gray[Illustrations from the Openscapes blog Tidy Data for reproducibility, efficiency, and collaboration by Julia Lowndes and Allison Horst]]]] --- background-image: url(../images/tidy_data_slide.jpg) background-size: cover <span role="img" aria-label="Stylized text providing an overview of Tidy Data. The top reads “Tidy data is a standard way of mapping the meaning of a dataset to its structure. - Hadley Wickham.” On the left reads “In tidy data: each variable forms a column; each observation forms a row; each cell is a single measurement.” There is an example table on the lower right with columns ‘id’, ‘name’ and ‘color’ with observations for different cats, illustrating tidy data structure."></span> --- class: middle # .link-blue[<i class="fa fa-cake-candles" aria-hidden="true"></i>] Tidy time Let's make a tidy table with our baking bots. <style> code-green code { padding: 30px !important; padding-left: 38px !important; border-left: solid 12px #50e3c2; font-size: 1.5rem !important; } </style> .big[.code-green[ ```r # Character vector of baking_bot names baking_bots <- c("Whiskers", "Baker-waker", "BB-8") # Numeric vector of bot ages bot_ages <- c(1, 2, NA) ``` ]] --- class: <div style="height: 240px; overflow: hidden; margin-top: 16px; margin-left: -240px; width: 140%;"> <img src="../images/filter_horst.png" style="max-width: 109%;" alt="Cartoon showing three fuzzy monsters either selecting or crossing out rows of a data table. If the type of animal in the table is “otter” and the site is 'bay', a monster is drawing a purple rectangle around the row. If those conditions are not met, another monster is putting a line through the column indicating it will be excluded. Stylized text reads 'dplyr::filter() - keep rows that satisfy your conditions.'"> </div> --- <style> .aqua {color: #0098a6;} .gray {color: gray;} </style> # Meet the .gray[monsters] <img src="../images/monsters/monster_data.png" style="width: 60%; margin-top: -12px;"> --- <div style="height: 170px; overflow:hidden;"> <img src="../images/monsters/filter_monsters.png" style="width: 100%; margin-top: -4px;"> </div> -- <div style="height: 430px; overflow:hidden; margin-top: 20px;"> <img src="../images/monsters/filter_monsters.png" style="width: 100%; margin-top: -212px;"> </div> --- <div style="height: 170px; overflow:hidden;"> <img src="../images/monsters/filter_monsters_multiple.png" style="width: 100%; margin-top: -4px;"> </div> -- <div style="height: 430px; overflow:hidden; margin-top: 20px;"> <img src="../images/monsters/filter_monsters_multiple.png" style="width: 100%; margin-top: -212px;"> </div> --- # Key terms <style> .remark-slide table {border-top: 0;} th, td {padding-left: 16px; padding-right: 16px; padding-top: 7px;} .bluecode code {font-weight: 700} </style> <div class="bluecode" style="font-size: 1.11rem; width: 76%; margin-top: 32px;"> <table> <thead> <tr> <th style="text-align:center;"> Term </th> <th style="text-align:left;"> Definition </th> </tr> </thead> <tbody> <tr> <td style="text-align:center;"> <code> object </code> </td> <td style="text-align:left;"> A variable in R that we assign different values to using the assignment operator. </td> </tr> <tr> <td style="text-align:center;"> <code> <- </code> </td> <td style="text-align:left;"> The <b>left-arrow</b> or assignment operator can assign a value to a new object or update an existing object. </td> </tr> <tr> <td style="text-align:center;"> <code> package </code> </td> <td style="text-align:left;"> An add-on for R that contains new functions someone created to help you. It's like an App for R. </td> </tr> <tr> <td style="text-align:center;"> <code> library </code> </td> <td style="text-align:left;"> The name of the folder that stores all your packages, and the function used to load a package. </td> </tr> <tr> <td style="text-align:center;"> <code> function </code> </td> <td style="text-align:left;"> Functions perform an operation on your data and returns a result. The function <code>sum()</code> takes a series of values and returns the sum for you. </td> </tr> <tr> <td style="text-align:center;"> <code> argument </code> </td> <td style="text-align:left;"> Arguments are options or inputs we pass to a function to change how it behaves. The argument <code>skip = 1</code> tells the <code>read_csv()</code> function to ignore the first row when reading in a data file. To see the default values for a function you can type <code>?read_csv</code> in the console. </td> </tr> </tbody> </table> </div> --- class: inverse, center, middle # <i class="fas fa-carrot" aria-hidden="true"></i> [Back to Videos](https://tidy-mn.github.io/R-camp-penguins/page/videos.html)