Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Create an Anonymous Function | Anonymous Functions in R
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Functions and Functional Programming in R
close
SectionΒ 2. ChapterΒ 2
single

single

bookChallenge: Create an Anonymous Function

Swipe to show menu

Task

Swipe to start coding

Write three anonymous functions in R and assign them to variables as described below:

  • Create an anonymous function that adds 3 to its input and assign it to the variable add_three.
  • Create an anonymous function that returns TRUE if a number is even, and assign it to the variable is_even.
  • Create an anonymous function that concatenates two strings (with no separator), and assign it to the variable concat_strings.

Each function should be assigned to the specified variable name. Do not use named function definitions for this task.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 2. ChapterΒ 2
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

some-alt