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

More iteration with purrr

Now you will change each element of a list into a numeric data type and then put it back into the same element in the same list, but instead of using a for loop, you'll use map().

You can use the purrr function map() to more easily loop over a list, and turn the characters into numbers. Instead of having to build a whole for loop, you can use one line of code.

Bu egzersiz

Foundations of Functional Programming with purrr

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

Egzersiz talimatları

  • Check the class of the first element of list_of_df.
  • Use map() to iterate over list_of_df and change each element of the list into numeric data.
  • Check the class of the first element of list_of_df.
  • Print out list_of_df.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Check the class type of the first element
class(___[[___]])  

# Change each character element to a number
list_of_df <- map(___, ___)

# Check the class type of the first element again
class(___[[___]])

# Print out the list
Kodu Düzenle ve Çalıştır