Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Challenge: Real-World Anonymous Functions | Anonymous Functions in R
Functions and Functional Programming in R

bookChallenge: Real-World Anonymous Functions

Taak

Swipe to start coding

Use your knowledge of anonymous functions and lapply to solve a practical data transformation problem.
Write a function capitalize_first that takes a list of names and returns a new list where each name has its first letter capitalized.

  • Use lapply to apply an anonymous function to each element of names_list.
  • The anonymous function should capitalize only the first letter of each name, leaving the rest unchanged.
  • The function must return a list with the transformed names.

Oplossing

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 2. Hoofdstuk 6
single

single

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

Suggested prompts:

Can you explain that in more detail?

What are the main benefits or drawbacks?

Can you give me an example?

close

bookChallenge: Real-World Anonymous Functions

Veeg om het menu te tonen

Taak

Swipe to start coding

Use your knowledge of anonymous functions and lapply to solve a practical data transformation problem.
Write a function capitalize_first that takes a list of names and returns a new list where each name has its first letter capitalized.

  • Use lapply to apply an anonymous function to each element of names_list.
  • The anonymous function should capitalize only the first letter of each name, leaving the rest unchanged.
  • The function must return a list with the transformed names.

Oplossing

Switch to desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 2. Hoofdstuk 6
single

single

some-alt