Skip to main content
HomeR

Introduction to Writing Functions in R

4.7+
30 reviews
Beginner

Take your R skills up a notch by learning to write efficient, reusable functions.

Start Course for Free
4 hours14 videos52 exercises45,200 learnersTrophyStatement of Accomplishment

Create Your Free Account

GoogleLinkedInFacebook

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.
Group

Training 2 or more people?

Try DataCamp for Business

Loved by learners at thousands of companies


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.
For Business

Training 2 or more people?

Get your team access to the full DataCamp platform, including all the features.
DataCamp for BusinessFor a bespoke solution book a demo.

In the following Tracks

Certification Available

Associate Data Scientist in R

Go To Track

R Developer

Go To Track

R Programming Fundamentals

Go To Track
  1. 1

    How to Write a Function

    Free

    Learn why writing your own functions is useful, how to convert a script into a function, and what order you should include the arguments.

    Play Chapter Now
    Why you should use functions
    50 xp
    Calling functions
    100 xp
    The benefits of writing functions
    50 xp
    Converting scripts into functions
    50 xp
    Converting a script to a function
    100 xp
    Your first function: tossing a coin
    100 xp
    Inputs to functions
    100 xp
    Multiple inputs to functions
    100 xp
    Y kant I reed ur code?
    50 xp
    Data or detail?
    100 xp
    Renaming GLM
    100 xp
For Business

Training 2 or more people?

Get your team access to the full DataCamp platform, including all the features.

In the following Tracks

Certification Available

Associate Data Scientist in R

Go To Track

R Developer

Go To Track

R Programming Fundamentals

Go To Track

datasets

Snake River visitsStandard & Poor 500 price/earnings ratiosNASS corn yieldsNASS wheat yieldsNASS barley yields

collaborators

Collaborator's avatar
Marianna Lamnina
Richie Cotton HeadshotRichie Cotton

Data Evangelist at DataCamp

Richie is a Data Evangelist at DataCamp. He has been using R since 2004, in the fields of proteomics, debt collection, and chemical health and safety. He has released almost 30 R packages on CRAN and Bioconductor – most famously the assertive suite of packages – as well as creating and contributing to many others. He also has written two books on R programming, Learning R and Testing R Code.
See More

Don’t just take our word for it

*4.7
from 30 reviews
80%
17%
0%
3%
0%
Sort by
  • Julia Z.
    9 months

    Great!!! I really liked that course.

  • Olga L.
    12 months

    Interactive hands-on course

  • Thomas H.
    12 months

    This will change my workflow for the better. Can put to use what I learned on any current project, and clean up and improve my scattered library of scripts.

  • Vern V.
    about 1 year

    As with other courses at Datacamp, this course was relevant, informative, balanced (theory vs practical), and engaging. Provides a good and solid foundation upon which to build one's capacity to writeand use functions in R.

  • Guisseppe V.
    over 1 year

    Very helpful to update my skills in creating functions to my daily job.

"Great!!! I really liked that course."

Julia Z.

"Interactive hands-on course"

Olga L.

"This will change my workflow for the better. Can put to use what I learned on any current project, and clean up and improve my scattered library of scripts."

Thomas H.

Join over 15 million learners and start Introduction to Writing Functions in R today!

Create Your Free Account

GoogleLinkedInFacebook

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.