Challenge: Inline Functions with apply
Tarea
Swipe to start coding
Use your understanding of anonymous functions and the apply family to classify each element in a numeric vector as "positive", "negative", or "zero".
- Create function
determine_signthat take a list. - Use
sapplywith an anonymous function to process each element of the input vector. - The function must return a character vector of the same length as the input, with each element classified as "positive", "negative", or "zero".
The result for (3, -2, 0, 7, -5) should look like:
"positive" "negative" "zero" "positive" "negative"
Solución
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 2. Capítulo 4
single
Pregunte a AI
Pregunte a AI
Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla
Genial!
Completion tasa mejorada a 5.56
Challenge: Inline Functions with apply
Desliza para mostrar el menú
Tarea
Swipe to start coding
Use your understanding of anonymous functions and the apply family to classify each element in a numeric vector as "positive", "negative", or "zero".
- Create function
determine_signthat take a list. - Use
sapplywith an anonymous function to process each element of the input vector. - The function must return a character vector of the same length as the input, with each element classified as "positive", "negative", or "zero".
The result for (3, -2, 0, 7, -5) should look like:
"positive" "negative" "zero" "positive" "negative"
Solución
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 2. Capítulo 4
single