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

bookChallenge: Real-World Anonymous Functions

Tâche

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.

Solution

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 2. Chapitre 6
single

single

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

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

Glissez pour afficher le menu

Tâche

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.

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 2. Chapitre 6
single

single

some-alt