Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Challenge: Inline Functions with apply | Anonymous Functions in R
Functions and Functional Programming in R

bookChallenge: Inline Functions with apply

Завдання

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_sign that take a list.
  • Use sapply with 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"

Рішення

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 2. Розділ 4
single

single

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

close

bookChallenge: Inline Functions with apply

Свайпніть щоб показати меню

Завдання

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_sign that take a list.
  • Use sapply with 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"

Рішення

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 2. Розділ 4
single

single

some-alt