Build your ultimate AI agent
Course Description
Being able to write your own functions makes your analyses more readable, with fewer errors, and more reusable from project to project. Function writing will increase your productivity more than any other skill! In this course you'll learn the basics of function writing, focusing on the arguments going into the function and the return values. You'll be writing useful data science functions, and using real-world data on Wyoming tourism, stock price/earnings ratios, and grain yields.
Prerequisites
Curriculum
Course outline
1
How to Write a Function
Learn why writing your own functions is useful, how to convert a script into a function, and what order you should include the arguments.
- Why you should use functions50 XP
- Calling functions100 XP
- The benefits of writing functions50 XP
- Converting scripts into functions50 XP
- Converting a script to a function100 XP
- Your first function: tossing a coin100 XP
- Inputs to functions100 XP
- Multiple inputs to functions100 XP
- Y kant I reed ur code?50 XP
- Data or detail?100 XP
- Renaming GLM100 XP
2
All About Arguments
Learn how to set defaults for arguments, how to pass arguments between functions, and how to check that users specified arguments correctly.
3
Return Values and Scope
Learn how to return early from a function, how to return multiple values, and understand how R decides which variables exist.
4
Case Study on Grain Yields
Apply your function writing skills to a case study involving data preparation, visualization, and modeling.
R
Introduction to Writing Functions in R
Course
Complete

