 In the tidyverse, tall data is convenient for iteration. Wide data is often useful for display. You should know how to transform your data from wide to long, or wide to tall, and vice versa. Wrangling these transformations has made simpler when you know a tidy introductory amount about regular expressions, and I'll introduce some specialized functions to simplify the transformation of multivalued fields. The first two videos in this series demonstrated how to iterate over a vector and introduce the per-map function. Just brief introductions, we'll dive deeper into that as the series progresses. In the meantime, I want to show a few tips about data wrangling, and the tips here are about separating multivalued fields and making data wider and longer. First, the separate grows function. It's a specialized function that transforms data into tall data format. In R, iterating over tall data can be more convenient and efficient, more convenient, more efficient, easier than writing a for loop. Nothing wrong with writing a for loop, but if you don't have to, this works really well. In this example, the primary professions variable is a multivalued field where each value is separated by a comma, and while the separate rows function can guess at the field separator, in this case a comma, a best practice codes the set equals argument to identify the separator. When we separate the data, the goal is to make one row for each value of the multivalued field. This is going to make the data taller, for longer, and transform the table from a 1000 row data frame to almost 3000 rows. As we run this function, notice that Fred Astaire from the name variable, is listed as having three primary professions, soundtrack, actor, and miscellaneous. All three are values listed in one variable within the same observation or row. But this is really three observations, and I want to follow tidying data principles, which is one row for each observation. The end result will be transforming this one row into three separate rows. It's easily accomplished with a specialized function called separate rows. Once transformed, notice that the other variables have some redundant data. It's not a big concern. But now we have the data transformed into a shape that's easier to iterate. It's easier to make a bar plot with the ggplot2 bar plot function for visualizing the frequency of professions, and I'll show you that at the end of this video. An alternative to making data tall is making data wider for a multi-value field. We may choose to separate the single variable into one variable for each value in the field. To do that, we can use the mutate function, but a specialized function is the separate function. It works similarly to the separate rows function, and then you can use an argument to identify the separator in this case a comma. By virtue of making the data wider, we mutate the tibble into more variables. This is done by identifying the new variable names using the into equals argument, which takes a character vector for its value. Let's see this in action. Notice in this argument, I'm using the str underscore count function part of the Stringer package, which enables me to leverage regular expressions or regex for finding patterns and data. I'll demonstrate more about regex in the regex lesson, but for now the important bits are that regex is composable code used to identify patterns and text. These patterns, they can get very abstract, but the simple patterns are easy to learn and they're very powerful. The simple pattern seen in line 127 is where I use the pattern of a literal comma. I'm using the str underscore count function to count how many patterns there are in a multi-value field. For example, in the known for titles field, a multi-value field contains up to four IMDB IDs representing the most widely known titles related to the primary name observation, that is a row. I can count the total number of commas and add one, and this gives me the number of values, that is the number of IMDB IDs in the multi-value field. Then I'll assign this number to a variable called prolificacy. Using the same regex pattern as my argument, I invoke the separate function, different from the separate rows function, to make the tipple wider and making the tipple wider splits the multi-value field into multiple columns. In this example, I transform known for titles into four discrete variables or columns. The code chunk that begins at line 121 demonstrates three different ways to use the simple regex pattern in a data transformation. I use specialized functions to transform data from wide to tall and then tall to wide. Of course, with a bit more code, I could do the same thing with the pivot wider and pivot longer functions, functions that I demonstrate in an earlier ARPUN video, an earlier ARPUN workshop, and I'll try and link that in the description. I tend to use the pivot wider and pivot longer functions more often, but these functions separate and separate rows are so handy that they're good to know about. But now for the cool part. Since I know how to transform my tipple with a multi-value field that is primary profession, I can use separate rows to pivot the variable longer. Then, it's easier to iterate over tall data with the geon bar function in ggplot2. For more advanced examples, stay tuned for later videos as I combine regex pivoting along with other custom functions.