Custom functions, tidy evaluation, and data masking
code available at https://github.com/libjohn/workshop_rfun_iterate nest group data into a data frame https://youtu.be/kZf11zbVpr0 iterate over grouped rows of data https://youtu.be/ExDaJUiivZw https://youtu.be/wMJb5Kcuwuc full video series -- playlist -- https://www.youtube.com/watch?v=PrUnbYlC1kY&list=PLIUcX1JrVUNWW7RgPh9ysmJM3mBpIAlYG Using the case-study of data cleaning, this modular video series will demonstrate iteration with purrr::map() and custom functions while also showing several Tidyverse tips and tricks. This individual video (# 3) in the series presents custom functions in R. R is a functional programming language. The general recommendation is to write a custom function anytime you perform the same operation more than twice. Being able to compose custom functions in R and the Tidyverse increases your R-coding fluency. Creating functions in the Tidyverse can impose the special confounding issues of tidy evaluation and data masking. The Tidyverse is very easy because of these two issues -- tidy evaluation and data masking -- but functions can be a bit more complex as well. Watch this video to be introduced and introduced to the concepts as I demystify the issues. Each #IterateFunctionsR video will become progressively more fluent, using building-blocks to present intermediate data manipulation techniques in R and the Tidyverse. By the end of the series you'll learn how to use the purrr package, a very convenient package in support of iterating over list-columns and nested data frames. purrr::map() iteration is often more convenient and efficient than a For-loop. You'll also learn how to compose custom functions in R. since R is a functional programming language, composing your own custom functions can increase your fluency as an R coder. Contents: 0:00 - introduction 0:11 - functions, composing custom 4:15 - tidy evaluation & data masking 5:20 - environment variable 5:36 - data variable 5:40 - data masking and embracing with curly-curly brackets {{}} 7:40 - anonymous function 8:10 - .x -- a pronoun used in an anonymous function 9:10 - iterating a function over each row of the data frame Materials available at https://github.com/libjohn/workshop_rfun_iterate stringr cheatsheet - https://stringr..tidyverse.org More Rfun at https://Rfun.library.duke.edu/
Download
0 formatsNo download links available.