BaşlayınÜcretsiz Başlayın

Pipes in map()

So you've refreshed your memory on how pipes can be used between functions. You can also use pipes on the inside of map() function to help you iterate a pipeline of tasks over a list of inputs.

Here instead of using one of the repurrrsive datasets, you will be working with a list of numbers so that you can do a few mathematical operations.

Bu egzersiz

Foundations of Functional Programming with purrr

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Create a list that contains the values 1 through 10, each as a separate element.
  • Create a pipeline within one map() function that takes the sqrt() of each element, and then the sin() of each element.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Create a list of values from 1 through 10
numlist <- list(___)

# Iterate over the numlist 
map(___, ~.x %>% ___ %>% ___)
Kodu Düzenle ve Çalıştır