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

Using parLapply()

An online seller has a hundred thousand products on their website. For the next Big Bumper Sale, they have announced a 20% discount on everything.

The online seller has hired you as a Data Engineer to handle price updates. Your client has asked you to update these prices using parallelization. You have the price_list and the function that discounts the price, discount_fun(), in your workspace. You need to apply discount_fun() to all elements of price_list. The parallel package has already been loaded.

Bu egzersiz

Parallel Programming in R

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

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

discount_fun <- function(price) price * 0.8

# Make a cluster with three cores
local_cluster <- ___(___)
Kodu Düzenle ve Çalıştır